From 89c7ddeb37bb9355e7272f9ed2bfdeb8faabdedc Mon Sep 17 00:00:00 2001 From: zhangwei <1504152376@qq.com> Date: 星期四, 14 八月 2025 17:09:22 +0800 Subject: [PATCH] '-' --- src/router/utils.ts | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/router/utils.ts b/src/router/utils.ts index 28e32b8..b5e524f 100644 --- a/src/router/utils.ts +++ b/src/router/utils.ts @@ -21,10 +21,12 @@ import { userKey, type DataInfo } from "@/utils/auth"; import { type menuType, routerArrays } from "@/layout/types"; import { useMultiTagsStoreHook } from "@/store/modules/multiTags"; +import { useUserStoreHook } from "@/store/modules/user"; import { usePermissionStoreHook } from "@/store/modules/permission"; const IFrame = () => import("@/layout/frame.vue"); // https://cn.vitejs.dev/guide/features.html#glob-import const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}"); +const quanxianList = ["/item"]; // 鍔ㄦ�佽矾鐢� import { getAsyncRoutes } from "@/api/routes"; @@ -54,9 +56,15 @@ /** 杩囨护meta涓璼howLink涓篺alse鐨勮彍鍗� */ function filterTree(data: RouteComponent[]) { + const hasFlsh = useUserStoreHook().nowRole.hasFlsh; const newTree = cloneDeep(data).filter( - (v: { meta: { showLink: boolean } }) => v.meta?.showLink !== false + (v: { meta: { showLink: boolean } }) => { + quanxianList.includes(v.path) ? (v.meta.showLink = hasFlsh) : null; + return v.meta?.showLink !== false; + } ); + console.log(newTree); + newTree.forEach( (v: { children }) => v.children && (v.children = filterTree(v.children)) ); @@ -387,7 +395,7 @@ usePermissionStoreHook().wholeMenus[0]?.children[0] ); tag && useMultiTagsStoreHook().handleTags("push", topMenu); - console.log(topMenu, "topMenu"); + // console.log(topMenu, "topMenu"); return topMenu; } -- Gitblit v1.9.1