feat(权限管理): 屏蔽包含 summary 的路由
- 在 filterAsyncRouter 函数中添加了对包含 summary 的路由的过滤 - 优化了代码格式,增加了空行
Showing
1 changed file
with
5 additions
and
1 deletions
| ... | @@ -64,6 +64,10 @@ const permission = { | ... | @@ -64,6 +64,10 @@ const permission = { |
| 64 | // 遍历后台传来的路由字符串,转换为组件对象 | 64 | // 遍历后台传来的路由字符串,转换为组件对象 |
| 65 | function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) { | 65 | function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) { |
| 66 | return asyncRouterMap.filter(route => { | 66 | return asyncRouterMap.filter(route => { |
| 67 | + // 屏蔽包含 summary 的路由 | ||
| 68 | + if (route.path.includes('summary')) { | ||
| 69 | + return false; | ||
| 70 | + } | ||
| 67 | if (type && route.children) { | 71 | if (type && route.children) { |
| 68 | route.children = filterChildren(route.children) | 72 | route.children = filterChildren(route.children) |
| 69 | } | 73 | } |
| ... | @@ -199,7 +203,7 @@ function routeItemInfo(data) { | ... | @@ -199,7 +203,7 @@ function routeItemInfo(data) { |
| 199 | meta: { title: item.name, icon: item.icon || '' } | 203 | meta: { title: item.name, icon: item.icon || '' } |
| 200 | } | 204 | } |
| 201 | ] | 205 | ] |
| 202 | - | 206 | + |
| 203 | 207 | ||
| 204 | }; | 208 | }; |
| 205 | routes.push(route); | 209 | routes.push(route); | ... | ... |
-
Please register or login to post a comment