用vue-cli搭建项目的 关于main.js

所有的要用到全局的比如说  vue 、router、初始页面app 、 ElementUI。。。。

都需要导入和定义

import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
//定义全局变量
Vue.use(ElementUI);
Vue.config.productionTip = false;
Vue.prototype.$post=post;
Vue.prototype.$get=get;
Vue.prototype.$delete=del;
Vue.prototype.$patch=patch;
Vue.prototype.$stors=store;

new Vue({
el: '#app',
router,
store,//使用store
components: { App },
template: '<App/>'
});










posted @ 2019-02-21 15:57  我就是要叫鱼摆摆  阅读(941)  评论(0编辑  收藏  举报