main.js
2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import Vue from 'vue';
import VueI18n from 'vue-i18n';
import App from './App.vue';
import router from './router';
import store from './store/index';
import {
httpGet,
httpPost
} from '@/api/fetch-api.js';
import VueAwesomeSwiper from 'vue-awesome-swiper'
import 'swiper/dist/css/swiper.css'
Vue.use(VueAwesomeSwiper)
// vant
import {
Collapse,
CollapseItem,
Icon
} from 'vant';
Vue.use(Collapse).use(CollapseItem);
Vue.use(Icon);
import Mock from './mock'
Mock.bootstrap();
// 视频
import VueVideoPlayer from 'vue-video-player'
import 'video.js/dist/video-js.css'
Vue.use(VueVideoPlayer)
// import 'amfe-flexible';
Vue.config.productionTip = false
// Purecss
// import Purecss from 'purecss'
// Vue.use(Purecss);
// 国际化
Vue.use(VueI18n)
const i18n = new VueI18n({
locale: localStorage.getItem("lang") || 'tc', // 语言标识
messages: {
'tc': require('@/common/lang/tc'), // 繁体语言包
'zh': require('@/common/lang/zh'), // 简体语言包
'en': require('@/common/lang/en'), // 英文语言包
}
})
let vueInstance = new Vue({
i18n,
router,
store,
render: h => h(App),
mounted: () => {
document.dispatchEvent(new Event('render-event'));
},
data: {
eventBus: new Vue(),
queryConfigData: null, // 1.放内存
// queryConfigData: localStorage.getItem("queryConfig") || null, // 2.放localStorage
}
}).$mount('#app');
// window.vueInstance = vueInstance; // 实在不满足需要,可以把vue实例挂载到windows上
/**
* 初始化请求配置
* 根据需要看放内存还是放localStorage
*
* 具体方法访问方法见 首页index.js mounted方法
* 具体方法访问方法见 首页index.js mounted方法
* 具体方法访问方法见 首页index.js mounted方法
*/
function initQueryConfig() {
/**
* 请求配置 httpGet/httpPost已引入
* 这里先setTimeout 模拟
*/
setTimeout(() => {
let configResult = {
a:123
}
vueInstance.queryConfigData = configResult; // 放内存
// localStorage.setItem("queryConfig",JSON.stringify(configResult)); // 放localStorage
}, 1000);
}
initQueryConfig();