import Vue from 'vue'; import iView from 'iview'; import VueRouter from 'vue-router'; import Routers from './router'; import store from './store'; import Util from './libs/util'; import App from './App.vue'; import 'iview/dist/styles/iview.css'; import './libs/common.css'; Vue.use(VueRouter); Vue.use(iView); // 添加中央事件总线 Vue.prototype.$bus = new Vue(); // 路由配置 const RouterConfig = { mode: 'hash', routes: Routers }; const router = new VueRouter(RouterConfig); router.beforeEach((to, from, next) => { iView.LoadingBar.start(); // console.log(to.meta); Util.title(to.meta.title); next(); }); router.afterEach((to, from, next) => { iView.LoadingBar.finish(); window.scrollTo(0, 0); }); new Vue({ el: '#app', router: router, store, render: h => h(App) });