From b071a40c2b3518d74c394b150f72dfa992997dba Mon Sep 17 00:00:00 2001 From: hwj Date: Tue, 3 Mar 2026 15:01:27 +0800 Subject: [PATCH] =?UTF-8?q?style=EF=BC=9A=E4=BF=AE=E6=94=B9=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E8=B7=B3=E8=BD=AC=E9=A6=96=E9=A1=B5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/permission.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/permission.ts b/src/permission.ts index dfd774d7..8201e1d6 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -67,7 +67,7 @@ const resolveFirstMenuPath = (routes: any[], parentPath = ''): string | undefine const currentPath = parentPath ? resolveChildPath(parentPath, String(r.path ?? '')) : String(r.path ?? '') const childPath = resolveFirstMenuPath(r.children, currentPath) if (childPath) return childPath - if (currentPath && currentPath !== '/') return currentPath + if (currentPath) return currentPath } return undefined } @@ -119,7 +119,12 @@ router.beforeEach(async (to, from, next) => { next(nextData) } else { if (to.path === '/') { - next({ path: resolveFirstMenuPath(permissionStore.addRouters) ?? '/empty', replace: true }) + const firstMenuPath = resolveFirstMenuPath(permissionStore.addRouters) ?? '/empty' + if (firstMenuPath === '/') { + next() + } else { + next({ path: firstMenuPath, replace: true }) + } return } next()