55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
|
import Vue from 'vue';
|
|||
|
import App from './App';
|
|||
|
import store from '@/store';
|
|||
|
import * as filters from '@/common/filters.js';
|
|||
|
import mqttTool from '@/common/mqttTool.js';
|
|||
|
import bus from "@/common/bus.js"
|
|||
|
|
|||
|
Vue.prototype.$mqttTool = mqttTool;
|
|||
|
Vue.prototype.$bus = bus;
|
|||
|
|
|||
|
// 注入全局过滤器
|
|||
|
Object.keys(filters).forEach(key => {
|
|||
|
Vue.filter(key, filters[key])
|
|||
|
})
|
|||
|
|
|||
|
// 引入uview
|
|||
|
import uView from '@/uni_modules/uview-ui';
|
|||
|
Vue.use(uView);
|
|||
|
|
|||
|
// 全局引入vuex
|
|||
|
let vuexStore = require("@/store/$u.mixin.js");
|
|||
|
Vue.mixin(vuexStore);
|
|||
|
|
|||
|
// 引入扩展方法
|
|||
|
import '@/common/extend.js';
|
|||
|
Vue.config.productionTip = false
|
|||
|
|
|||
|
App.mpType = 'app'
|
|||
|
|
|||
|
import VueI18n from 'vue-i18n';
|
|||
|
import messages from '@/locale';
|
|||
|
Vue.use(VueI18n);
|
|||
|
const i18n = new VueI18n({
|
|||
|
locale: wx.getStorageSync('language') || 'zh-CN',
|
|||
|
messages, // 设置语言环境信息
|
|||
|
silentFallbackWarn: true,
|
|||
|
})
|
|||
|
Vue.prototype.$tt = Vue.prototype.$t; //设置别名,因为$t已经在项目中有使用
|
|||
|
const app = new Vue({
|
|||
|
store,
|
|||
|
i18n,
|
|||
|
...App
|
|||
|
})
|
|||
|
// http拦截器,将此部分放在new Vue()和app.$mount()之间,才能App.vue中正常使用
|
|||
|
import httpInterceptor from '@/apis/http.interceptor.js'
|
|||
|
Vue.use(httpInterceptor, app)
|
|||
|
|
|||
|
// http接口API集中管理引入部分
|
|||
|
import httpApi from '@/apis/http.api.js'
|
|||
|
Vue.use(httpApi, app)
|
|||
|
|
|||
|
import tools from '@/common/tools.js';
|
|||
|
Vue.use(tools, app)
|
|||
|
|
|||
|
app.$mount()
|