huangbin hace 4 años
padre
commit
be95c1a63d
Se han modificado 1 ficheros con 4 adiciones y 3 borrados
  1. 4 3
      src/layout/components/menu.vue

+ 4 - 3
src/layout/components/menu.vue

@@ -5,7 +5,7 @@
           v-model:selectedKeys="selectedKeys"
           v-model:openKeys="openKeys"
           @click="menuClick">
-    <a-sub-menu v-for="item in menuList"
+    <a-sub-menu v-for="item in filterMenu()"
                 :key="item.code">
       <template #title>
         <span>
@@ -89,9 +89,10 @@ export default defineComponent({
                 openKeys.value = preOpenKeys.value;
             }
         });
+        const filterMenu = () => menuList.value.filter((e: OperationTabMenu) => e.type === 1);
         initData(() => {
             // 处理路由跳转到菜单栏里第一个对应的页面
-            const list = unref(menuList);
+            const list = filterMenu();
             if (list.length && list[0].children && list[0].children.length) {
                 // 处理修改具体某个菜单栏,主要处理页面刷新
                 let firstIndex = 0,
@@ -113,7 +114,7 @@ export default defineComponent({
                 context.emit('chooseMenu', temp);
             }
         });
-        return { selectedKeys, openKeys, menuList, menuClick, fontIcon };
+        return { selectedKeys, openKeys, filterMenu, menuClick, fontIcon };
     },
 });
 </script>