Przeglądaj źródła

过滤隐藏菜单显示

@dongkboy 1 rok temu
rodzic
commit
92c24c2009
1 zmienionych plików z 2 dodań i 1 usunięć
  1. 2 1
      src/utils/composables/routeUtils.ts

+ 2 - 1
src/utils/composables/routeUtils.ts

@@ -13,6 +13,7 @@ export interface RouteItem {
     title?: string;
     icon?: string;
     auth?: string[];
+    menu?:boolean;
   };
   children?: RouteItem[];
 }
@@ -75,7 +76,7 @@ const parseAuthToChildren = (authList: string[]): TreeNode[] => {
 // 将 RouteItem 转换为 TreeNode
 export const convertToTreeData = (id:number,routes: RouteItem[]): TreeNode[] => {
   idCounter.value=id;
-  return routes.map(route => {
+  return routes.filter(route => route.meta?.menu !== false).map(route => {
     const node: TreeNode = {
       id: generateId(),
       title: route.meta?.title || route.name || '',