From 58b27c96932ba89b362138a6056a82c25a7be282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9C=E9=9D=92=E8=8F=9C=E7=99=BD=E7=8E=89=E6=B1=A4?= =?UTF-8?q?=E2=80=9D?= <2075125282@qq.com> Date: Mon, 9 Jan 2023 10:39:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(projects):=20=E4=BF=AE=E5=A4=8D=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E8=B7=AF=E7=94=B1=E6=A8=A1=E5=BC=8F=E4=B8=8B=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E4=B8=8D=E6=8E=92=E5=BA=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/route/index.ts | 5 +++-- src/utils/router/module.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/store/modules/route/index.ts b/src/store/modules/route/index.ts index c1f38c49e..5b1e24b86 100644 --- a/src/store/modules/route/index.ts +++ b/src/store/modules/route/index.ts @@ -11,7 +11,8 @@ import { transformAuthRouteToMenu, transformAuthRouteToSearchMenus, transformRouteNameToRoutePath, - transformRoutePathToRouteName + transformRoutePathToRouteName, + sortRoutes } from '@/utils'; import { useAuthStore } from '../auth'; import { useTabStore } from '../tab'; @@ -119,7 +120,7 @@ export const useRouteStore = defineStore('route-store', { if (!error) { this.routeHomeName = data.home; this.handleUpdateRootRedirect(data.home); - this.handleAuthRoute(data.routes); + this.handleAuthRoute(sortRoutes(data.routes)); initHomeTab(data.home, router); diff --git a/src/utils/router/module.ts b/src/utils/router/module.ts index 5f5a43403..49872364b 100644 --- a/src/utils/router/module.ts +++ b/src/utils/router/module.ts @@ -2,7 +2,7 @@ * 权限路由排序 * @param routes - 权限路由 */ -function sortRoutes(routes: AuthRoute.Route[]) { +export function sortRoutes(routes: AuthRoute.Route[]) { return routes.sort((next, pre) => Number(next.meta?.order) - Number(pre.meta?.order)); }