1.让菜单生成不经过动态路由
修改 src/router/index.js
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
export default new Router({
mode: 'history',
base: process.env.BASE_URL,
scrollBehavior: () => ({ y: 0 }),
routes:staticRoutes.concat(routes),
})
2.增加src/layouts/BasicLayout.vue第73行起
import { routes } from '@/router';
3.修改src/layouts/BasicLayout.vue
const menus = routes.find((item) => item.path === '/').children;
4.修改src/router/router-guards/index.ts
从判断是否存在token开始替换
修改完成保留token,取消动态路由
网友评论