Skip to content

Commit

Permalink
fix: Menu菜单组件显示bug,renderMenuItem返回的数组存在undefined数据,导致省略菜单显示问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Cwealth committed Dec 18, 2023
1 parent 64ee9c2 commit 1c63757
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/Menu/src/components/useRenderMenuItem.tsx
Expand Up @@ -12,9 +12,10 @@ export const useRenderMenuItem = (
menuMode: 'vertical' | 'horizontal'
) => {
const renderMenuItem = (routers: AppRouteRecordRaw[], parentPath = '/') => {
return routers.map((v) => {
const meta = v.meta ?? {}
if (!meta.hidden) {
return routers
.filter((v) => !v.meta?.hidden)
.map((v) => {
const meta = v.meta ?? {}
const { oneShowingChild, onlyOneChild } = hasOneShowingChild(v.children, v)
const fullPath = isUrl(v.path) ? v.path : pathResolve(parentPath, v.path) // getAllParentPath<AppRouteRecordRaw>(allRouters, v.path).join('/')

Expand Down Expand Up @@ -48,8 +49,7 @@ export const useRenderMenuItem = (
</ElSubMenu>
)
}
}
})
})
}

return {
Expand Down

0 comments on commit 1c63757

Please sign in to comment.