From 88ab464d6aa143900afc97bfd1f159a5959d47ff Mon Sep 17 00:00:00 2001 From: Azure <983547216@qq.com> Date: Tue, 23 Jun 2026 12:06:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B7=AF=E7=94=B1bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/guard.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/router/guard.ts b/src/router/guard.ts index a655401..d92771e 100644 --- a/src/router/guard.ts +++ b/src/router/guard.ts @@ -49,8 +49,8 @@ function setupCommonGuard(router: Router) { return { path: '/auth/login', query: { redirect: to.fullPath }, replace: true } } - // 没有访问权限,跳转登录页面 - if (to.fullPath !== '/auth/login') { + // 没有访问权限,跳转登录页面(使用 to.path 而非 to.fullPath,避免 query 参数导致无限重定向) + if (to.path !== '/auth/login') { return { path: '/auth/login', query: { redirect: to.fullPath }, @@ -58,7 +58,8 @@ function setupCommonGuard(router: Router) { replace: true } } - return to + // 登录页面且已带 redirect 参数(由上面逻辑设置),允许进入 + return true } return true