Commit 0595a72da9c666af81a0916663e8e6a014e6fa69
1 parent
c7c0a7e4
fix(mix-sider): fix mix-sider hover logic
修复左侧混合菜单的悬停处理逻辑
Showing
2 changed files
with
11 additions
and
8 deletions
CHANGELOG.zh_CN.md
src/layouts/default/sider/MixSider.vue
... | ... | @@ -80,10 +80,10 @@ |
80 | 80 | <script lang="ts"> |
81 | 81 | import type { Menu } from '/@/router/types'; |
82 | 82 | import type { CSSProperties } from 'vue'; |
83 | + import { computed, defineComponent, onMounted, ref, unref } from 'vue'; | |
83 | 84 | import type { RouteLocationNormalized } from 'vue-router'; |
84 | - import { defineComponent, onMounted, ref, computed, unref } from 'vue'; | |
85 | 85 | import { ScrollContainer } from '/@/components/Container'; |
86 | - import { SimpleMenuTag } from '/@/components/SimpleMenu'; | |
86 | + import { SimpleMenu, SimpleMenuTag } from '/@/components/SimpleMenu'; | |
87 | 87 | import { Icon } from '/@/components/Icon'; |
88 | 88 | import { AppLogo } from '/@/components/Application'; |
89 | 89 | import Trigger from '../trigger/HeaderTrigger.vue'; |
... | ... | @@ -93,11 +93,10 @@ |
93 | 93 | import { useDesign } from '/@/hooks/web/useDesign'; |
94 | 94 | import { useI18n } from '/@/hooks/web/useI18n'; |
95 | 95 | import { useGo } from '/@/hooks/web/usePage'; |
96 | - import { SIDE_BAR_SHOW_TIT_MINI_WIDTH, SIDE_BAR_MINI_WIDTH } from '/@/enums/appEnum'; | |
96 | + import { SIDE_BAR_MINI_WIDTH, SIDE_BAR_SHOW_TIT_MINI_WIDTH } from '/@/enums/appEnum'; | |
97 | 97 | import clickOutside from '/@/directives/clickOutside'; |
98 | - import { getShallowMenus, getChildrenMenus, getCurrentParentPath } from '/@/router/menus'; | |
98 | + import { getChildrenMenus, getCurrentParentPath, getShallowMenus } from '/@/router/menus'; | |
99 | 99 | import { listenerRouteChange } from '/@/logics/mitt/routeChange'; |
100 | - import { SimpleMenu } from '/@/components/SimpleMenu'; | |
101 | 100 | |
102 | 101 | export default defineComponent({ |
103 | 102 | name: 'LayoutMixSider', |
... | ... | @@ -179,6 +178,7 @@ |
179 | 178 | return !unref(getMixSideFixed) |
180 | 179 | ? { |
181 | 180 | onMouseleave: () => { |
181 | + setActive(true); | |
182 | 182 | closeMenu(); |
183 | 183 | }, |
184 | 184 | } |
... | ... | @@ -219,6 +219,10 @@ |
219 | 219 | } else { |
220 | 220 | closeMenu(); |
221 | 221 | } |
222 | + } else { | |
223 | + if (!unref(openMenu)) { | |
224 | + openMenu.value = true; | |
225 | + } | |
222 | 226 | } |
223 | 227 | if (!unref(openMenu)) { |
224 | 228 | setActive(); |
... | ... | @@ -241,8 +245,7 @@ |
241 | 245 | async function setActive(setChildren = false) { |
242 | 246 | const path = currentRoute.value?.path; |
243 | 247 | if (!path) return; |
244 | - const parentPath = await getCurrentParentPath(path); | |
245 | - activePath.value = parentPath; | |
248 | + activePath.value = await getCurrentParentPath(path); | |
246 | 249 | // hanldeModuleClick(parentPath); |
247 | 250 | if (unref(getIsMixSidebar)) { |
248 | 251 | const activeMenu = unref(menuModules).find((item) => item.path === unref(activePath)); |
... | ... | @@ -496,7 +499,6 @@ |
496 | 499 | &-menu-list { |
497 | 500 | position: fixed; |
498 | 501 | top: 0; |
499 | - width: 0; | |
500 | 502 | width: 200px; |
501 | 503 | height: calc(100%); |
502 | 504 | background-color: #fff; | ... | ... |