feat: Add dynamic route

This commit is contained in:
kailong321200875
2022-02-19 20:34:44 +08:00
parent d5b6e2a777
commit 9d926b2760
15 changed files with 851 additions and 66 deletions

View File

@@ -424,31 +424,60 @@ export const asyncRouterMap: AppRouteRecordRaw[] = [
},
children: [
{
path: '404',
path: '404-demo',
component: () => import('@/views/Error/404.vue'),
name: '404',
name: '404Demo',
meta: {
title: '404'
}
},
{
path: '403',
path: '403-demo',
component: () => import('@/views/Error/403.vue'),
name: '403',
name: '403Demo',
meta: {
title: '403'
}
},
{
path: '500',
path: '500-demo',
component: () => import('@/views/Error/500.vue'),
name: '500',
name: '500Demo',
meta: {
title: '500'
}
}
]
}
// {
// path: '/authorization',
// component: Layout,
// redirect: '/authorization/user',
// name: 'Authorization',
// meta: {
// title: t('router.authorization'),
// icon: 'eos-icons:role-binding',
// alwaysShow: true
// },
// children: [
// {
// path: 'user',
// component: () => import('@/views/Authorization/User.vue'),
// name: 'User',
// meta: {
// title: t('router.user')
// }
// },
// {
// path: 'role',
// component: () => import('@/views/Authorization/Role.vue'),
// name: 'Role',
// meta: {
// title: t('router.role')
// }
// }
// ]
// }
]
const router = createRouter({
@@ -459,7 +488,7 @@ const router = createRouter({
})
export const resetRouter = (): void => {
const resetWhiteNameList = ['RedirectRoot', 'Redirect', 'Login', 'Root', 'Dashboard', 'Page404']
const resetWhiteNameList = ['Redirect', 'Login', 'NoFind']
router.getRoutes().forEach((route) => {
const { name } = route
if (name && !resetWhiteNameList.includes(name as string)) {