From 9c4889f0859bc60decf0ef40c383c1946de1d68a Mon Sep 17 00:00:00 2001 From: Lan <6995syu@163.com> Date: Wed, 21 Jul 2021 23:27:24 +0800 Subject: [PATCH] fix(perm-guard): Fix the problem that the routing query is lost after refreshing the page (#941) --- src/router/guard/permissionGuard.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/router/guard/permissionGuard.ts b/src/router/guard/permissionGuard.ts index 1fe9e7507ff..4a4395c7901 100644 --- a/src/router/guard/permissionGuard.ts +++ b/src/router/guard/permissionGuard.ts @@ -88,7 +88,8 @@ export function createPermissionGuard(router: Router) { if (to.name === PAGE_NOT_FOUND_ROUTE.name) { // 动态添加路由后,此处应当重定向到fullPath,否则会加载404页面内容 - next({ path: to.fullPath, replace: true }); + // fix: 添加query以免丢失 + next({ path: to.fullPath, replace: true, query: to.query }); } else { const redirectPath = (from.query.redirect || to.path) as string; const redirect = decodeURIComponent(redirectPath);