fix: 修复一级菜单问题

This commit is contained in:
YeMingfei666 2025-09-10 14:11:41 +08:00
parent 0499e36a5b
commit 723902ac09
1 changed files with 1 additions and 6 deletions

View File

@ -29,11 +29,7 @@
</el-menu-item> </el-menu-item>
</AppLink> </AppLink>
</template> </template>
<template <template v-else-if="item.children && hasOneShowingChild(item.children, item)">
v-else-if="
item.children && item.children.length == 1 && hasOneShowingChild(item.children, item)
"
>
<AppLink <AppLink
v-if="onlyOneChild.meta" v-if="onlyOneChild.meta"
:to="{ :to="{
@ -124,7 +120,6 @@ function hasOneShowingChild(children: RouteRecordRaw[] = [], parent: RouteRecord
// //
const showingChildren = children.filter((route: RouteRecordRaw) => { const showingChildren = children.filter((route: RouteRecordRaw) => {
if (!route.meta?.hidden) { if (!route.meta?.hidden) {
console.log(route);
onlyOneChild.value = route; onlyOneChild.value = route;
return true; return true;
} }