1
0
mirror of https://github.com/zclzone/vue-naive-admin.git synced 2025-05-01 14:49:00 +08:00

fix: 当用户访问一个当前用户没有的权限时导航去404

This commit is contained in:
leipu 2024-12-22 11:21:48 +08:00
parent 9a22ac1659
commit be2dedf4e4
2 changed files with 3 additions and 0 deletions

View File

@ -44,6 +44,7 @@ export function createPermissionGuard(router) {
} }
router.addRoute({ router.addRoute({
name: 'catchAll',
path: '/:catchAll(.*)', path: '/:catchAll(.*)',
redirect: '/404', redirect: '/404',
}) })

View File

@ -16,6 +16,8 @@ export const useRouterStore = defineStore('router', () => {
accessRoutes.forEach((item) => { accessRoutes.forEach((item) => {
router.hasRoute(item.name) && router.removeRoute(item.name) router.hasRoute(item.name) && router.removeRoute(item.name)
}) })
router.removeRoute('catchAll')
} }
return { return {