Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix:修复左侧菜单混合模式中,固定展开菜单问题(#204) (#238)
Browse files Browse the repository at this point in the history
* fix:修复左侧菜单混合模式中,固定展开菜单问题(#204)

Signed-off-by: aonoa <1991849113@qq.com>

* chore:删除日志打印

Signed-off-by: aonoa <1991849113@qq.com>

---------

Signed-off-by: aonoa <1991849113@qq.com>
  • Loading branch information
aonoa authored Nov 1, 2023
1 parent 4934305 commit de399dc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/hooks/src/setting/useMenuSetting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export function useMenuSetting() {
})

const getIsFixed = computed(() => {
return unref(getMixSideFixed) && unref(mixSideHasChildren)
return unref(getMixSideFixed)// && unref(mixSideHasChildren)
})

// Set menu configuration
Expand Down
16 changes: 15 additions & 1 deletion packages/layouts/src/components/mixSideBar/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ const childrenMenus = ref<Menu[]>([])
const openMenu = ref(false)
const sideRef = ref<ElRef>(null)
const childrenTitle = ref('')
let oldIsFixed = unref(getIsFixed)
let pushpin = unref(getIsFixed)
onMounted(async () => {
menuModules.value = await getShallowMenus()
Expand Down Expand Up @@ -84,7 +86,7 @@ const handleModuleClick = async (path: string, hover = false, title = '') => {
}
}
if (!unref(openMenu)) {
setActive()
await setActive()
}
} else {
openMenu.value = true
Expand All @@ -101,6 +103,17 @@ const handleModuleClick = async (path: string, hover = false, title = '') => {
}
const getMenuStyle = computed((): CSSProperties => {
if (getIsFixed.value) {
setActive(true)
} else {
if (oldIsFixed != unref(getIsFixed) && !pushpin) {
closeMenu()
} else {
pushpin = false
}
}
oldIsFixed = unref(getIsFixed)
return {
width: unref(openMenu) ? `${unref(getMenuWidth)}px` : 0,
left: `${props.mixSidebarWidth}px`,
Expand Down Expand Up @@ -185,6 +198,7 @@ const handleFixedMenu = () => {
setMenuSetting({
mixSideFixed: !unref(getIsFixed),
})
pushpin = !unref(getIsFixed);
}
</script>

Expand Down

0 comments on commit de399dc

Please sign in to comment.