import Vue from 'vue'
import App from './App.vue'
import router from './router/index'
import store from './store'
import dataV from '@jiaminghi/data-view'
import "../src/assets/less/index.less";//公
import "../src/assets/iconfont.css";//图标icon
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import Avue from '@smallwei/avue';
import '@smallwei/avue/lib/index.css';
import {islogined} from "./servuces/token";
import VueRouter from 'vue-router'

Vue.use(dataV);//datav组件库
Vue.use(ElementUI);//element组件库
Vue.use(VueRouter);//element组件库
Vue.use(Avue);//element组件库


Vue.config.productionTip = false;

router.beforeEach((to,from,next)=>{
  if(to.meta.needlogin){
    if(islogined()){
      next();
    }else{
      next('/login')
    }
  }else{
    next()
  }
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
