|
- import Vue from 'vue'
- import VueRouter from 'vue-router'
- import PageRouter from './page/'
- import ViewsRouter from './views/'
- import AvueRouter from './avue-router'
- import Store from '../store/'
- Vue.use(VueRouter)
- //创建路由
- // console.log(PageRouter,ViewsRouter,'123')
- // console.log(Store)
- // console.log(process.env.BASE_URL,123);
- export const createRouter = () => new VueRouter({
- // mode:'history',
- // base:'/wel/index',
- routes: [...PageRouter, ...ViewsRouter]
-
- })
-
- const Router = createRouter()
- console.log(Router,'路由');
- AvueRouter.install(Router, Store)
- Router.$avueRouter.formatRoutes(Store.state.user.menu, true)
- // 重置路由
- export function resetRouter () {
- const newRouter = createRouter()
- Router.matcher = newRouter.matcher
- AvueRouter.install(Router, Store)
- }
- export default Router
|