ruoyi-plus-soybean/src/utils/router/helpers.ts

20 lines
526 B
TypeScript
Raw Normal View History

/**
*
* @param routes -
*/
export function getConstantRouteNames(routes: AuthRoute.Route[]) {
return routes.map(route => getConstantRouteName(route)).flat(1);
}
/**
*
* @param route -
*/
function getConstantRouteName(route: AuthRoute.Route) {
const names = [route.name];
if (route.children?.length) {
names.push(...route.children!.map(item => getConstantRouteName(item)).flat(1));
}
return names;
}