From a642c322e376c30adaf8740bc94db107032cc438 Mon Sep 17 00:00:00 2001 From: ss <> Date: Tue, 14 May 2024 23:14:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B7=BB=E5=8A=A0=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E5=A1=AB=E5=86=99=E4=BA=86=E9=87=8D=E5=AE=9A=E5=90=91?= =?UTF-8?q?=EF=BC=8C=E7=84=B6=E5=90=8E=E8=8F=9C=E5=8D=95=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=B8=BA=E2=80=9C=E8=8F=9C=E5=8D=95=E2=80=9D=20=E4=BC=9A?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E9=87=8D=E5=AE=9A=E5=90=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/router/generator-routers.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/web/src/router/generator-routers.ts b/web/src/router/generator-routers.ts index 34774e6..48b0112 100644 --- a/web/src/router/generator-routers.ts +++ b/web/src/router/generator-routers.ts @@ -36,12 +36,16 @@ export const routerGenerator = (routerMap, parent?): any[] => { // 为了防止出现后端返回结果不规范,处理有可能出现拼接出两个 反斜杠 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) { //如果未定义 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 currentRouter.children = routerGenerator(item.children, currentRouter); }