ruoyi-plus-soybean/src/router/routes.ts

72 lines
1.8 KiB
TypeScript
Raw Normal View History

2021-08-17 14:59:59 +08:00
import type { RouteRecordRaw } from 'vue-router';
2021-09-09 12:00:18 +08:00
import { BasicLayout, BlankLayout } from '@/layouts';
import { EnumRoutePaths } from '@/enum';
type RouteKey = keyof typeof EnumRoutePaths;
/** 路由名称 */
export const RouteNameMap = new Map<RouteKey, RouteKey>((Object.keys(EnumRoutePaths) as RouteKey[]).map(v => [v, v]));
/**
*
* @description !
*/
export const constantRoutes: Array<RouteRecordRaw> = [
{
name: 'system',
path: '/system',
component: BlankLayout,
redirect: { name: 'not-found' },
children: [
// 登录
{
name: RouteNameMap.get('login'),
path: EnumRoutePaths.login,
component: () => import('@/views/system/login/index.vue')
},
// 404
{
name: RouteNameMap.get('not-found'),
path: EnumRoutePaths['not-found'],
component: () => import('@/views/system/exception/404.vue')
},
// 403
{
name: RouteNameMap.get('no-permission'),
path: EnumRoutePaths['no-permission'],
component: () => import('@/views/system/exception/403.vue')
},
// 500
{
name: RouteNameMap.get('service-error'),
path: EnumRoutePaths['service-error'],
component: () => import('@/views/system/exception/500.vue')
}
]
},
// 匹配无效的路径重定向404
{
path: '/:pathMatch(.*)*',
redirect: { name: 'not-found' }
}
];
2021-08-17 14:59:59 +08:00
/**
*
*/
export const customRoutes: Array<RouteRecordRaw> = [
{
name: 'root',
path: '/',
2021-08-18 12:02:59 +08:00
redirect: '/home',
component: BasicLayout,
children: [
{
name: 'home',
path: '/home',
component: () => import('@/views/home/index.vue')
}
]
2021-08-17 14:59:59 +08:00
}
];