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

79 lines
1.5 KiB
TypeScript
Raw Normal View History

import { getLoginModuleRegExp } from '@/utils';
/** 根路由: / */
export const ROOT_ROUTE: AuthRoute.Route = {
name: 'root',
path: '/',
redirect: import.meta.env.VITE_ROUTE_HOME_PATH,
meta: {
title: 'Root'
}
};
/** 固定的路由 */
export const constantRoutes: AuthRoute.Route[] = [
ROOT_ROUTE,
{
name: 'login',
path: '/login',
component: 'self',
props: route => {
const moduleType = (route.params.module as EnumType.LoginModuleKey) || 'pwd-login';
return {
module: moduleType
};
},
meta: {
title: '登录',
dynamicPath: `/login/:module(${getLoginModuleRegExp()})?`,
singleLayout: 'blank'
}
},
{
name: 'constant-page',
path: '/constant-page',
component: 'self',
meta: {
title: '固定页面',
singleLayout: 'blank'
}
},
{
name: 'no-permission',
path: '/no-permission',
component: 'self',
meta: {
title: '无权限',
singleLayout: 'blank'
}
},
{
name: 'not-found',
path: '/not-found',
component: 'self',
meta: {
title: '未找到',
singleLayout: 'blank'
}
},
{
name: 'service-error',
path: '/service-error',
component: 'self',
meta: {
title: '服务器错误',
singleLayout: 'blank'
}
},
2022-01-11 19:03:42 +08:00
// 匹配无效路径的路由
{
name: 'not-found-page',
path: '/:pathMatch(.*)*',
component: 'blank',
meta: {
title: '未找到',
singleLayout: 'blank'
}
}
];