fix: 修复处于顶部模式时 el-menu 未自适应宽度去折叠的问题 (#153)
Co-authored-by: pany <939630029@qq.com>
This commit is contained in:
parent
56f294d51c
commit
9510639b49
@ -60,10 +60,7 @@ const resolvePath = (routePath: string) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div :class="{ 'simple-mode': props.isCollapse && !isTop, 'first-level': props.isFirstLevel }">
|
||||||
v-if="!props.item.meta?.hidden"
|
|
||||||
:class="{ 'simple-mode': props.isCollapse && !isTop, 'first-level': props.isFirstLevel }"
|
|
||||||
>
|
|
||||||
<template v-if="!alwaysShowRootMenu && theOnlyOneChild && !theOnlyOneChild.children">
|
<template v-if="!alwaysShowRootMenu && theOnlyOneChild && !theOnlyOneChild.children">
|
||||||
<SidebarItemLink v-if="theOnlyOneChild.meta" :to="resolvePath(theOnlyOneChild.path)">
|
<SidebarItemLink v-if="theOnlyOneChild.meta" :to="resolvePath(theOnlyOneChild.path)">
|
||||||
<el-menu-item :index="resolvePath(theOnlyOneChild.path)">
|
<el-menu-item :index="resolvePath(theOnlyOneChild.path)">
|
||||||
|
@ -29,7 +29,7 @@ const activeMenu = computed(() => {
|
|||||||
} = route
|
} = route
|
||||||
return activeMenu ? activeMenu : path
|
return activeMenu ? activeMenu : path
|
||||||
})
|
})
|
||||||
|
const noHiddenRoutes = computed(() => permissionStore.routes.filter((item) => !item.meta?.hidden))
|
||||||
const isCollapse = computed(() => !sidebar.value.opened)
|
const isCollapse = computed(() => !sidebar.value.opened)
|
||||||
const isLeft = computed(() => layoutMode.value === "left")
|
const isLeft = computed(() => layoutMode.value === "left")
|
||||||
const isTop = computed(() => layoutMode.value === "top")
|
const isTop = computed(() => layoutMode.value === "top")
|
||||||
@ -68,7 +68,7 @@ const hiddenScrollbarVerticalBar = computed(() => {
|
|||||||
:mode="isTop && !isMobile ? 'horizontal' : 'vertical'"
|
:mode="isTop && !isMobile ? 'horizontal' : 'vertical'"
|
||||||
>
|
>
|
||||||
<SidebarItem
|
<SidebarItem
|
||||||
v-for="route in permissionStore.routes"
|
v-for="route in noHiddenRoutes"
|
||||||
:key="route.path"
|
:key="route.path"
|
||||||
:item="route"
|
:item="route"
|
||||||
:base-path="route.path"
|
:base-path="route.path"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user