Skip to content

Commit

Permalink
Merge pull request #179 from sunhao1256/main
Browse files Browse the repository at this point in the history
fix(projects): sortRoutes recursively
  • Loading branch information
honghuangdc authored Feb 12, 2023
2 parents 0b5afda + 9188941 commit 6bb6d9f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/utils/router/module.ts
Original file line number Diff line number Diff line change
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

1 comment on commit 6bb6d9f

@vercel
Copy link

@vercel vercel bot commented on 6bb6d9f Feb 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.