zhangwei
2025-08-18 35cf8d289a09a6a4a34cf3d73fb41d84969ae4ee
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中showLink为false的菜单 */
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;
}