RuoYi
2020-11-30 1147ea5f8aba836dbde5969988fcb7db9c49fb11
ruoyi-ui/src/store/modules/permission.js
@@ -1,6 +1,7 @@
import { constantRoutes } from '@/router'
import { getRouters } from '@/api/menu'
import Layout from '@/layout/index'
import ParentView from '@/components/ParentView';
const permission = {
  state: {
@@ -32,14 +33,12 @@
// 遍历后台传来的路由字符串,转换为组件对象
function filterAsyncRouter(asyncRouterMap) {
  return asyncRouterMap.filter(route => {
    if(!route.path){
      // 防止空路由出现的警告,设置默认path
      route.path = '/path';
    }
    if (route.component) {
      // Layout组件特殊处理
      // Layout ParentView 组件特殊处理
      if (route.component === 'Layout') {
        route.component = Layout
      } else if (route.component === 'ParentView') {
        route.component = ParentView
      } else {
        route.component = loadView(route.component)
      }