mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-09-17 16:56:39 +08:00
Merge pull request #102 from zhangshican/v2.0
修复添加菜单填写了重定向,然后菜单类型为“菜单” 会执行重定向
This commit is contained in:
commit
e672f54fbb
@ -36,12 +36,16 @@ export const routerGenerator = (routerMap, parent?): any[] => {
|
|||||||
|
|
||||||
// 为了防止出现后端返回结果不规范,处理有可能出现拼接出两个 反斜杠
|
// 为了防止出现后端返回结果不规范,处理有可能出现拼接出两个 反斜杠
|
||||||
currentRouter.path = currentRouter.path.replace('//', '/');
|
currentRouter.path = currentRouter.path.replace('//', '/');
|
||||||
// 重定向
|
// 重定向 ,菜单类型为目录默认默认跳转
|
||||||
item.redirect && (currentRouter.redirect = item.redirect);
|
if(item.meta.type === 1){
|
||||||
|
item.redirect && (currentRouter.redirect = item.redirect);
|
||||||
|
}
|
||||||
// 是否有子菜单,并递归处理
|
// 是否有子菜单,并递归处理
|
||||||
if (item.children && item.children.length > 0) {
|
if (item.children && item.children.length > 0) {
|
||||||
//如果未定义 redirect 默认第一个子路由为 redirect
|
//如果未定义 redirect 默认第一个子路由为 redirect
|
||||||
!item.redirect && (currentRouter.redirect = `${item.path}/${item.children[0].path}`);
|
if(item.meta.type === 1) {
|
||||||
|
!item.redirect && (currentRouter.redirect = `${item.path}/${item.children[0].path}`);
|
||||||
|
}
|
||||||
// Recursion
|
// Recursion
|
||||||
currentRouter.children = routerGenerator(item.children, currentRouter);
|
currentRouter.children = routerGenerator(item.children, currentRouter);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user