main.js 1.22 KB
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还没挂载。