70 lines
1.8 KiB
JavaScript
70 lines
1.8 KiB
JavaScript
|
|
|
|||
|
|
import Vue from 'vue'
|
|||
|
|
import App from './App'
|
|||
|
|
|
|||
|
|
Vue.config.productionTip = false
|
|||
|
|
|
|||
|
|
App.mpType = 'app'
|
|||
|
|
// 引入全局 uView 框架
|
|||
|
|
import uView from 'uview-ui'
|
|||
|
|
Vue.use(uView)
|
|||
|
|
|
|||
|
|
|
|||
|
|
// 全局存储 vuex 的封装
|
|||
|
|
import store from '@/store'
|
|||
|
|
|
|||
|
|
// 引入 uView 提供的对 vuex 的简写法文件
|
|||
|
|
let vuexStore = require('@/store/$u.mixin.js')
|
|||
|
|
Vue.mixin(vuexStore)
|
|||
|
|
|
|||
|
|
// 引入 uView 对小程序分享的 mixin 封装
|
|||
|
|
let mpShare = require('uview-ui/libs/mixin/mpShare.js')
|
|||
|
|
Vue.mixin(mpShare)
|
|||
|
|
|
|||
|
|
// Vue i18n 国际化
|
|||
|
|
import VueI18n from '@/common/vue-i18n.min.js'
|
|||
|
|
Vue.use(VueI18n)
|
|||
|
|
|
|||
|
|
// i18n 部分的配置,引入语言包,注意路径
|
|||
|
|
import lang_zh from '@/common/locales/zh_CN.js'
|
|||
|
|
import lang_en from '@/common/locales/en_EN.js'
|
|||
|
|
|
|||
|
|
const i18n = new VueI18n({
|
|||
|
|
// 默认语言
|
|||
|
|
locale: store.state.vuex_language,
|
|||
|
|
// 引入语言文件
|
|||
|
|
messages: {
|
|||
|
|
'zh_CN': lang_zh,
|
|||
|
|
'en_US': lang_en,
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
// 由于微信小程序的运行机制问题,需声明如下一行,H5和APP非必填
|
|||
|
|
// Vue.prototype._i18n = i18n
|
|||
|
|
const app = new Vue({
|
|||
|
|
i18n,
|
|||
|
|
store,
|
|||
|
|
...App
|
|||
|
|
})
|
|||
|
|
import * as echarts from "@/components/echarts/echarts.min.js"
|
|||
|
|
Vue.prototype.$echarts = echarts
|
|||
|
|
import { replaceAll } from '@/common/common.js'
|
|||
|
|
Vue.prototype.replaceAll = replaceAll
|
|||
|
|
|
|||
|
|
// http 拦截器,将此部分放在 new Vue() 和 app.$mount() 之间,才能 App.vue 中正常使用
|
|||
|
|
import httpInterceptor from '@/common/http.interceptor.js'
|
|||
|
|
Vue.use(httpInterceptor, app)
|
|||
|
|
|
|||
|
|
// http 接口 API 抽离,免于写 url 或者一些固定的参数
|
|||
|
|
import httpApi from '@/common/http.api.js'
|
|||
|
|
Vue.use(httpApi, app)
|
|||
|
|
|
|||
|
|
import {formatValue} from '@/common/common.js'
|
|||
|
|
Vue.prototype.$formatValue = formatValue
|
|||
|
|
import * as filters from '@/common/filters.js'
|
|||
|
|
// 定义全局自定义过滤器
|
|||
|
|
Object.keys(filters).forEach(key => {
|
|||
|
|
Vue.filter(key, filters[key])
|
|||
|
|
})
|
|||
|
|
app.$mount()
|