2022-05-09 23:51:19 +08:00
|
|
|
/**
|
|
|
|
* 获取所有固定路由的名称集合
|
|
|
|
* @param routes - 固定路由
|
|
|
|
*/
|
|
|
|
export function getConstantRouteNames(routes: AuthRoute.Route[]) {
|
|
|
|
return routes.map(route => getConstantRouteName(route)).flat(1);
|
|
|
|
}
|
2021-11-28 12:17:48 +08:00
|
|
|
|
2022-05-09 23:51:19 +08:00
|
|
|
/**
|
|
|
|
* 获取所有固定路由的名称集合
|
|
|
|
* @param route - 固定路由
|
|
|
|
*/
|
|
|
|
function getConstantRouteName(route: AuthRoute.Route) {
|
|
|
|
const names = [route.name];
|
2022-11-08 18:24:32 +08:00
|
|
|
if (route.children?.length) {
|
2022-05-09 23:51:19 +08:00
|
|
|
names.push(...route.children!.map(item => getConstantRouteName(item)).flat(1));
|
|
|
|
}
|
|
|
|
return names;
|
|
|
|
}
|