Skip to content

Commit

Permalink
fix(projects): sortRoutes recursively
Browse files Browse the repository at this point in the history
  • Loading branch information
sunhao1256 committed Feb 12, 2023
1 parent 0b5afda commit 9188941
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/utils/router/module.ts
Expand Up @@ -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;
});
}

/**
Expand Down

0 comments on commit 9188941

Please sign in to comment.