1、去除路由守卫

在src/main.js文件里面去掉

import './permission' // permission control

2、让菜单生成不经过动态路由

在src/router/index.js文件改为:

 import Vue from 'vue'
 import Router from 'vue-router'
  import { constantRouterMap, asyncRouterMap } from '@/config/router.config'
  
  Vue.use(Router)
  
  export default new Router({
    mode: 'history',
    base: process.env.BASE_URL,
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRouterMap.concat(asyncRouterMap)
  })

3、菜单

在src\layouts\BasicLayout.vue 中引入 import { asyncRouterMap } from '@/config/router.config.js'
created 函数修改为:

created () {
      this.menus = asyncRouterMap.find((item) => item.path === '/').children
      this.collapsed = !this.sidebarOpened
    },

注:参考https://blog.csdn.net/freewebsys/article/details/88361751

Logo

前往低代码交流专区

更多推荐