xachary
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
6 additions and
0 deletions
-
src/router/guard/permissionGuard.ts
|
|
|
@ -113,6 +113,11 @@ export function createPermissionGuard(router: Router) { |
|
|
|
} else if (from.query.redirect) { |
|
|
|
// 存在redirect
|
|
|
|
const redirect = decodeURIComponent((from.query.redirect as string) || ''); |
|
|
|
|
|
|
|
// 只处理一次 from.query.redirect
|
|
|
|
// 也避免某场景(指向路由定义了 redirect)下的死循环
|
|
|
|
from.query.redirect = ''; |
|
|
|
|
|
|
|
if (redirect === to.fullPath) { |
|
|
|
// 已经被redirect
|
|
|
|
next(); |
|
|
|
@ -120,6 +125,7 @@ export function createPermissionGuard(router: Router) { |
|
|
|
// 指向redirect
|
|
|
|
next({ path: redirect, replace: true }); |
|
|
|
} |
|
|
|
next(); |
|
|
|
} else { |
|
|
|
// 正常访问
|
|
|
|
next(); |
|
|
|
|