Merge pull request #383 from Cwealth/feat/Cwealth

fix: Menu菜单组件显示bug,renderMenuItem返回的数组存在undefined数据,导致省略菜单显示问题
This commit is contained in:
Archer 2023-12-19 09:08:20 +08:00 committed by GitHub
commit 0d159bacec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -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('/')
@ -48,8 +49,7 @@ export const useRenderMenuItem = (
</ElSubMenu>
)
}
}
})
})
}
return {