index.js 358 B

123456789101112131415161718192021222324
  1. import Vue from 'vue'
  2. import iView from 'iview'
  3. import VueRouter from 'vue-router'
  4. import routes from './routes'
  5. Vue.use(VueRouter)
  6. const router = new VueRouter({
  7. mode: 'history',
  8. routes,
  9. })
  10. router.beforeEach((to, from, next) => {
  11. iView.LoadingBar.start()
  12. next()
  13. })
  14. router.afterEach(() => {
  15. iView.LoadingBar.finish()
  16. })
  17. export default router