fix: Menu菜单组件显示bug,renderMenuItem返回的数组存在undefined数据,导致省略菜单显示问题
This commit is contained in:
parent
64ee9c208d
commit
1c63757d55
|
@ -12,9 +12,10 @@ export const useRenderMenuItem = (
|
||||||
menuMode: 'vertical' | 'horizontal'
|
menuMode: 'vertical' | 'horizontal'
|
||||||
) => {
|
) => {
|
||||||
const renderMenuItem = (routers: AppRouteRecordRaw[], parentPath = '/') => {
|
const renderMenuItem = (routers: AppRouteRecordRaw[], parentPath = '/') => {
|
||||||
return routers.map((v) => {
|
return routers
|
||||||
|
.filter((v) => !v.meta?.hidden)
|
||||||
|
.map((v) => {
|
||||||
const meta = v.meta ?? {}
|
const meta = v.meta ?? {}
|
||||||
if (!meta.hidden) {
|
|
||||||
const { oneShowingChild, onlyOneChild } = hasOneShowingChild(v.children, v)
|
const { oneShowingChild, onlyOneChild } = hasOneShowingChild(v.children, v)
|
||||||
const fullPath = isUrl(v.path) ? v.path : pathResolve(parentPath, v.path) // getAllParentPath<AppRouteRecordRaw>(allRouters, v.path).join('/')
|
const fullPath = isUrl(v.path) ? v.path : pathResolve(parentPath, v.path) // getAllParentPath<AppRouteRecordRaw>(allRouters, v.path).join('/')
|
||||||
|
|
||||||
|
@ -48,7 +49,6 @@ export const useRenderMenuItem = (
|
||||||
</ElSubMenu>
|
</ElSubMenu>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue