ant design vue 保留登录页,取消动态路由

2022-09-13  本文已影响0人  zZ_d205

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,取消动态路由

上一篇下一篇

猜你喜欢

热点阅读