index.js 654 B

12345678910111213141516171819202122232425262728
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. Vue.use(Router)
  4. const baseRoutes = [
  5. {
  6. path: '/notPermission',
  7. component: () => import('data-room-ui/NotPermission/index.vue')
  8. }
  9. ]
  10. export const constantRoutes = []
  11. const createRouter = () => new Router({
  12. mode: process.env.VUE_APP_HISTORY === 'y' ? 'history' : null,
  13. base: process.env.VUE_APP_HISTORY === 'y' ? process.env.VUE_APP_BASE : null,
  14. scrollBehavior: () => ({ y: 0 }),
  15. routes: baseRoutes
  16. })
  17. const router = createRouter()
  18. export function resetRouter () {
  19. const newRouter = createRouter()
  20. router.matcher = newRouter.matcher // reset router
  21. }
  22. export default router