Skip to content

Commit

Permalink
perf: 优化导航菜单折叠
Browse files Browse the repository at this point in the history
  • Loading branch information
hooray committed Oct 8, 2024
1 parent 0ae0f6f commit 1598324
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/layouts/components/Menu/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const handleSubMenuClick: MenuInjection['handleSubMenuClick'] = (index, indexPat
function initMenu() {
const activeItem = activeIndex.value && items.value[activeIndex.value]
setSubMenusActive(activeIndex.value)
if (!activeItem || props.collapse) {
if (!activeItem || isMenuPopup.value || props.collapse) {
return
}
// 展开该菜单项的路径上所有子菜单
Expand Down
4 changes: 2 additions & 2 deletions src/layouts/components/Menu/sub.vue
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ function handleMouseleave() {
<Teleport v-if="hasChildren" to="body" :disabled="!rootMenu.isMenuPopup">
<Transition v-bind="transitionClass" v-on="transitionEvent">
<OverlayScrollbarsComponent
v-if="opened" ref="subMenuRef" :options="{ scrollbars: { visibility: 'hidden' } }" defer class="sub-menu" :class="{
v-show="opened" ref="subMenuRef" :options="{ scrollbars: { visibility: 'hidden' } }" defer class="sub-menu static" :class="{
'bg-[var(--g-sub-sidebar-bg)]': rootMenu.isMenuPopup,
'ring-1 ring-stone-2 dark-ring-stone-8 shadow-xl fixed z-3000 w-[200px]': rootMenu.isMenuPopup,
'ring-1 ring-stone-2 dark-ring-stone-8 shadow-xl fixed! z-3000 w-[200px]': rootMenu.isMenuPopup,
'mx-1': rootMenu.isMenuPopup && (rootMenu.props.mode === 'vertical' || level !== 0),
'py-1': rootMenu.isMenuPopup,
}"
Expand Down

0 comments on commit 1598324

Please sign in to comment.