Commit 9c4889f0859bc60decf0ef40c383c1946de1d68a

Authored by Lan
Committed by GitHub
1 parent 59cf8605

fix(perm-guard): Fix the problem that the routing query is lost after refreshing the page (#941)

src/router/guard/permissionGuard.ts
@@ -88,7 +88,8 @@ export function createPermissionGuard(router: Router) { @@ -88,7 +88,8 @@ export function createPermissionGuard(router: Router) {
88 88
89 if (to.name === PAGE_NOT_FOUND_ROUTE.name) { 89 if (to.name === PAGE_NOT_FOUND_ROUTE.name) {
90 // 动态添加路由后,此处应当重定向到fullPath,否则会加载404页面内容 90 // 动态添加路由后,此处应当重定向到fullPath,否则会加载404页面内容
91 - next({ path: to.fullPath, replace: true }); 91 + // fix: 添加query以免丢失
  92 + next({ path: to.fullPath, replace: true, query: to.query });
92 } else { 93 } else {
93 const redirectPath = (from.query.redirect || to.path) as string; 94 const redirectPath = (from.query.redirect || to.path) as string;
94 const redirect = decodeURIComponent(redirectPath); 95 const redirect = decodeURIComponent(redirectPath);