Template
1
0
mirror of https://github.com/un-pany/v3-admin-vite.git synced 2025-04-20 19:09:21 +08:00

fix: 修复处于顶部模式时 el-menu 未自适应宽度去折叠的问题 (#153)

Co-authored-by: pany <939630029@qq.com>
This commit is contained in:
dingzhen 2024-01-04 22:59:02 +08:00 committed by GitHub
parent 56f294d51c
commit 9510639b49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

@ -60,10 +60,7 @@ const resolvePath = (routePath: string) => {
</script>
<template>
<div
v-if="!props.item.meta?.hidden"
:class="{ 'simple-mode': props.isCollapse && !isTop, 'first-level': props.isFirstLevel }"
>
<div :class="{ 'simple-mode': props.isCollapse && !isTop, 'first-level': props.isFirstLevel }">
<template v-if="!alwaysShowRootMenu && theOnlyOneChild && !theOnlyOneChild.children">
<SidebarItemLink v-if="theOnlyOneChild.meta" :to="resolvePath(theOnlyOneChild.path)">
<el-menu-item :index="resolvePath(theOnlyOneChild.path)">

View File

@ -29,7 +29,7 @@ const activeMenu = computed(() => {
} = route
return activeMenu ? activeMenu : path
})
const noHiddenRoutes = computed(() => permissionStore.routes.filter((item) => !item.meta?.hidden))
const isCollapse = computed(() => !sidebar.value.opened)
const isLeft = computed(() => layoutMode.value === "left")
const isTop = computed(() => layoutMode.value === "top")
@ -68,7 +68,7 @@ const hiddenScrollbarVerticalBar = computed(() => {
:mode="isTop && !isMobile ? 'horizontal' : 'vertical'"
>
<SidebarItem
v-for="route in permissionStore.routes"
v-for="route in noHiddenRoutes"
:key="route.path"
:item="route"
:base-path="route.path"