mirror of
				https://github.com/soybeanjs/soybean-admin.git
				synced 2025-11-04 15:53:43 +08:00 
			
		
		
		
	fix(projects): 修复动态路由模式下路由不排序的问题
This commit is contained in:
		@@ -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);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user