Commit 7279c0a7b592774071d6d561efad251cd04cc5b5
1 parent
ff2b12b4
refactor(menu): added 'SimpleMenu' component. Solve the menu stuck problem #199 #190 #191
Showing
4 changed files
with
13 additions
and
2 deletions
CHANGELOG.zh_CN.md
src/components/SimpleMenu/src/SimpleSubMenu.vue
@@ -76,7 +76,7 @@ | @@ -76,7 +76,7 @@ | ||
76 | const { prefixCls } = useDesign('simple-menu'); | 76 | const { prefixCls } = useDesign('simple-menu'); |
77 | 77 | ||
78 | const getShowMenu = computed(() => { | 78 | const getShowMenu = computed(() => { |
79 | - return !props.item.meta?.hideMenu; | 79 | + return !props.item?.hideMenu; |
80 | }); | 80 | }); |
81 | 81 | ||
82 | const getIcon = computed(() => props.item?.icon); | 82 | const getIcon = computed(() => props.item?.icon); |
src/router/helper/menuHelper.ts
@@ -45,6 +45,13 @@ export function transformMenuModule(menuModule: MenuModule): Menu { | @@ -45,6 +45,13 @@ export function transformMenuModule(menuModule: MenuModule): Menu { | ||
45 | export function transformRouteToMenu(routeModList: AppRouteModule[]) { | 45 | export function transformRouteToMenu(routeModList: AppRouteModule[]) { |
46 | const cloneRouteModList = cloneDeep(routeModList); | 46 | const cloneRouteModList = cloneDeep(routeModList); |
47 | const routeList: AppRouteRecordRaw[] = []; | 47 | const routeList: AppRouteRecordRaw[] = []; |
48 | + | ||
49 | + // cloneRouteModList = filter(cloneRouteModList, (node) => { | ||
50 | + // if (Reflect.has(node?.meta ?? {}, 'hideMenu')) { | ||
51 | + // return !node?.meta.hideMenu; | ||
52 | + // } | ||
53 | + // return true; | ||
54 | + // }); | ||
48 | cloneRouteModList.forEach((item) => { | 55 | cloneRouteModList.forEach((item) => { |
49 | if (item.meta?.single) { | 56 | if (item.meta?.single) { |
50 | const realItem = item?.children?.[0]; | 57 | const realItem = item?.children?.[0]; |
@@ -55,13 +62,14 @@ export function transformRouteToMenu(routeModList: AppRouteModule[]) { | @@ -55,13 +62,14 @@ export function transformRouteToMenu(routeModList: AppRouteModule[]) { | ||
55 | }); | 62 | }); |
56 | return treeMap(routeList, { | 63 | return treeMap(routeList, { |
57 | conversion: (node: AppRouteRecordRaw) => { | 64 | conversion: (node: AppRouteRecordRaw) => { |
58 | - const { meta: { title, icon } = {} } = node; | 65 | + const { meta: { title, icon, hideMenu = false } = {} } = node; |
59 | 66 | ||
60 | !isUrl(node.path) && joinParentPath(routeList, node); | 67 | !isUrl(node.path) && joinParentPath(routeList, node); |
61 | return { | 68 | return { |
62 | name: title, | 69 | name: title, |
63 | icon, | 70 | icon, |
64 | path: node.path, | 71 | path: node.path, |
72 | + hideMenu, | ||
65 | }; | 73 | }; |
66 | }, | 74 | }, |
67 | }); | 75 | }); |
src/router/types.ts