48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
|
|
import type { RouteRecordRaw } from 'vue-router'
|
||
|
|
import { Role } from '@/utils/permission/type'
|
||
|
|
|
||
|
|
const modules: any = import.meta.glob('./modules/*.ts', { eager: true })
|
||
|
|
const rolesRoutes: RouteRecordRaw[] = [...Object.keys(modules).map((key) => modules[key].default)]
|
||
|
|
|
||
|
|
export const routes: Array<RouteRecordRaw> = [
|
||
|
|
{
|
||
|
|
path: '/',
|
||
|
|
name: 'home',
|
||
|
|
component: () => import('@/components/layout/app-layout/index.vue'),
|
||
|
|
children: [
|
||
|
|
{
|
||
|
|
path: '/first',
|
||
|
|
name: 'first',
|
||
|
|
meta: { icon: 'House', title: '首页' },
|
||
|
|
component: () => import('@/views/first/index.vue')
|
||
|
|
},
|
||
|
|
...rolesRoutes
|
||
|
|
]
|
||
|
|
},
|
||
|
|
{
|
||
|
|
path: '/login',
|
||
|
|
name: 'login',
|
||
|
|
component: () => import('@/views/login/index.vue')
|
||
|
|
},
|
||
|
|
{
|
||
|
|
path: '/register',
|
||
|
|
name: 'register',
|
||
|
|
component: () => import('@/views/login/register/index.vue')
|
||
|
|
},
|
||
|
|
{
|
||
|
|
path: '/forgot_password',
|
||
|
|
name: 'forgot_password',
|
||
|
|
component: () => import('@/views/login/forgot-password/index.vue')
|
||
|
|
},
|
||
|
|
{
|
||
|
|
path: '/reset_password/:code/:email',
|
||
|
|
name: 'reset_password',
|
||
|
|
component: () => import('@/views/login/reset-password/index.vue')
|
||
|
|
},
|
||
|
|
{
|
||
|
|
path: '/:pathMatch(.*)',
|
||
|
|
name: '404',
|
||
|
|
component: () => import('@/views/404/index.vue')
|
||
|
|
}
|
||
|
|
]
|