mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
22 lines
781 B
TypeScript
22 lines
781 B
TypeScript
import type { RouteRecordRaw } from 'vue-router';
|
|
import { transformAuthRouteToVueRoute } from '@/utils';
|
|
import constantRoutes from './constant';
|
|
|
|
/** 所有路由 */
|
|
export const routes: RouteRecordRaw[] = constantRoutes.map(item => transformAuthRouteToVueRoute(item));
|
|
|
|
/** 路由名称 */
|
|
export const routeName = (key: AuthRoute.RouteKey) => key;
|
|
|
|
/** 路由路径 */
|
|
export function routePath(key: Exclude<AuthRoute.RouteKey, 'not-found-page'>): AuthRoute.RoutePath {
|
|
const rootPath: AuthRoute.RoutePath = '/';
|
|
if (key === 'root') return rootPath;
|
|
const splitMark: AuthRoute.RouteSplitMark = '_';
|
|
const pathSplitMark = '/';
|
|
const path = key.split(splitMark).join(pathSplitMark);
|
|
return (pathSplitMark + path) as AuthRoute.RoutePath;
|
|
}
|
|
|
|
export { constantRoutes };
|