mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-22 19:46:38 +08:00
fix(projects): sortRoutes recursively
This commit is contained in:
parent
0b5afda287
commit
918894147a
@ -3,7 +3,12 @@
|
||||
* @param routes - 权限路由
|
||||
*/
|
||||
export function sortRoutes(routes: AuthRoute.Route[]) {
|
||||
return routes.sort((next, pre) => Number(next.meta?.order) - Number(pre.meta?.order));
|
||||
return routes
|
||||
.sort((next, pre) => Number(next.meta?.order) - Number(pre.meta?.order))
|
||||
.map(i => {
|
||||
if (i.children) sortRoutes(i.children);
|
||||
return i;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user