You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

30 lines
815 B

  1. import Vue from 'vue'
  2. import VueRouter from 'vue-router'
  3. import PageRouter from './page/'
  4. import ViewsRouter from './views/'
  5. import AvueRouter from './avue-router'
  6. import Store from '../store/'
  7. Vue.use(VueRouter)
  8. //创建路由
  9. // console.log(PageRouter,ViewsRouter,'123')
  10. // console.log(Store)
  11. // console.log(process.env.BASE_URL,123);
  12. export const createRouter = () => new VueRouter({
  13. // mode:'history',
  14. // base:'/wel/index',
  15. routes: [...PageRouter, ...ViewsRouter]
  16. })
  17. const Router = createRouter()
  18. console.log(Router,'路由');
  19. AvueRouter.install(Router, Store)
  20. Router.$avueRouter.formatRoutes(Store.state.user.menu, true)
  21. // 重置路由
  22. export function resetRouter () {
  23. const newRouter = createRouter()
  24. Router.matcher = newRouter.matcher
  25. AvueRouter.install(Router, Store)
  26. }
  27. export default Router