| | |
| | | // https://cn.vitejs.dev/guide/features.html#glob-import |
| | | const modulesRoutes = import.meta.glob("/src/views/**/*.{vue,tsx}"); |
| | | const quanxianList = ["/item"]; |
| | | const managerList = ["/user"]; |
| | | |
| | | const userInfo = storageLocal().getItem<DataInfo<number>>(userKey); |
| | | // 动态路由 |
| | | import { getAsyncRoutes } from "@/api/routes"; |
| | | |
| | |
| | | /** 过滤meta中showLink为false的菜单 */ |
| | | function filterTree(data: RouteComponent[]) { |
| | | const hasFlsh = useUserStoreHook().nowRole.hasFlsh; |
| | | const isManager = useUserStoreHook().isManager; |
| | | const newTree = cloneDeep(data).filter( |
| | | (v: { meta: { showLink: boolean } }) => { |
| | | (v: { path: string; meta: { showLink: boolean } }) => { |
| | | quanxianList.includes(v.path) ? (v.meta.showLink = hasFlsh) : null; |
| | | managerList.includes(v.path) ? (v.meta.showLink = isManager) : null; |
| | | return v.meta?.showLink !== false; |
| | | } |
| | | ); |