fix(projects): 修复路由守卫的动态路由逻辑

This commit is contained in:
Soybean 2022-03-14 15:16:28 +08:00
parent 20911dd882
commit e6c26fcb4a
3 changed files with 12 additions and 5 deletions

3
components.d.ts vendored
View File

@ -16,6 +16,9 @@ declare module 'vue' {
IconCustomAvatar: typeof import('~icons/custom/avatar')['default']
IconCustomLogo: typeof import('~icons/custom/logo')['default']
IconCustomLogoFill: typeof import('~icons/custom/logo-fill')['default']
IconCustomNoPermission: typeof import('~icons/custom/no-permission')['default']
IconCustomNotFound: typeof import('~icons/custom/not-found')['default']
IconCustomServiceError: typeof import('~icons/custom/service-error')['default']
IconGridiconsFullscreen: typeof import('~icons/gridicons/fullscreen')['default']
IconGridiconsFullscreenExit: typeof import('~icons/gridicons/fullscreen-exit')['default']
IconIcOutlineCheck: typeof import('~icons/ic/outline-check')['default']

View File

@ -35,11 +35,12 @@ export async function createDynamicRouteGuard(
next({ path: to.fullPath, replace: true, query: to.query });
return false;
}
// 动态路由已经加载仍然未找到重定向到not-found
if (to.name === routeName('not-found-page')) {
next({ name: routeName('not-found'), replace: true });
return false;
}
}
// 动态路由已经加载仍然未找到重定向到not-found
if (to.name === routeName('not-found-page')) {
next({ name: routeName('not-found'), replace: true });
return false;
}
return true;

View File

@ -28,6 +28,9 @@ export default function subscribeThemeStore() {
} else {
removeDarkClass();
}
},
{
immediate: true,
}
);