Skip to content

Commit

Permalink
fix(projects): 修复路由守卫的动态路由逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Mar 14, 2022
1 parent 20911dd commit e6c26fc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
11 changes: 6 additions & 5 deletions src/router/guard/dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/store/subscribe/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export default function subscribeThemeStore() {
} else {
removeDarkClass();
}
},
{
immediate: true,
}
);

Expand Down

1 comment on commit e6c26fc

@vercel
Copy link

@vercel vercel bot commented on e6c26fc Mar 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.