79 lines
2.2 KiB
JavaScript
79 lines
2.2 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'
|
||
import lang_fr from '@/common/locales/fr_FR.js'
|
||
import lang_es from '@/common/locales/es_ES.js'
|
||
import lang_ar from '@/common/locales/ar_EG.js'
|
||
import lang_de from '@/common/locales/de_DE.js'
|
||
import lang_pl from '@/common/locales/pl_PL.js'
|
||
const i18n = new VueI18n({
|
||
// 默认语言
|
||
locale: store.state.vuex_language,
|
||
// 引入语言文件
|
||
messages: {
|
||
'zh_CN': lang_zh,
|
||
'en_US': lang_en,
|
||
'fr_FR': lang_fr, // 新增:法语
|
||
'es_ES': lang_es, // 新增:西班牙语
|
||
'ar_EG': lang_ar, // 新增:阿拉伯语
|
||
'de_DE': lang_de, // 新增:德语
|
||
'pl_PL': lang_pl // 新增:波兰语
|
||
}
|
||
})
|
||
|
||
// 由于微信小程序的运行机制问题,需声明如下一行,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()
|