Skip to content

Commit

Permalink
fix(Menu): 保证同级菜单项展开时可交互 (#855)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocean-gao authored Jul 1, 2024
1 parent 71f5793 commit 4d74139
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions components/menu/subMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,13 @@ export default defineComponent({
rootMenu.updateExpandedKeys([]);
}

// 若当前子菜单已关闭,则打开
await nextTick();
if (!rootMenu.currentExpandedKeys.value.includes(props.value || instance.uid)) {
isOpened.value = !isOpened.value;
rootMenu.handleSubMenuExpand(subMenu as unknown as MenuItemType, indexPath);
}
/**
* TODO: 待 同一层级只能展开一个子菜单 支持后,再增加 当前子菜单已关闭 的判断:
* !rootMenu.currentExpandedKeys.value.includes(props.value || instance.uid)
*/
isOpened.value = !isOpened.value;
rootMenu.handleSubMenuExpand(subMenu as unknown as MenuItemType, indexPath);
};
const handlePopperTriggerHide = async () => {
rootMenu.updatePopperShowSubMenu(props.value || instance.uid, 'hide');
Expand Down

0 comments on commit 4d74139

Please sign in to comment.