main.js
1.22 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
import Vue from 'vue'
import VueApp from './App.vue'
import router from './router'
import store from './store'
import api from '@/api/api'
import {
httpGet,
httpPost
} from '@/api/fetch-api.js'
// import Mock from './mock'
// Mock.bootstrap();
import 'amfe-flexible/index.js'
import '@/styles/index.scss' // global css
import '@/styles/index.scss' // global css
import '@/styles/fonticon.scss' // 图标字体
import '@/assets/fonts/font.scss' // 字体引入
// import '@styles/utils.scss' /*引入公共样式*/
Vue.config.productionTip = false
import {
Swipe,
SwipeItem,
Lazyload,
Tab,
Tabs,
Sticky,
Popup,
Tabbar,
TabbarItem,
Icon,
Toast,
Button
} from 'vant';
Vue.use(Swipe).use(SwipeItem)
.use(Lazyload)
.use(Tab).use(Tabs)
.use(Sticky)
.use(Popup)
.use(Tabbar).use(TabbarItem)
.use(Icon)
.use(Button)
.use(Toast);
let app = new Vue({
router,
store,
data: {
isInit: false,
},
render: h => h(VueApp)
}).$mount('#app')
// 挂载全局app
app.api = api;
app.get = httpGet;
app.post = httpPost;
app.router = router;
window.app = app;
// 原app节点请通过 document.getElementById('app') 获取
// routes里的component组件需要以import方式引入,否则页面创建的时候,app还没挂载。