Skip to content

Commit 1c9b7fe

Browse files
GaoNeng-wWwkagol
authored andcommitted
fix(menu): fix #1540
1 parent 551599d commit 1c9b7fe

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

packages/devui-vue/devui/menu/src/composables/use-click.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface clickEvent extends MouseEvent {
77
}
88

99
export function useClick(e: clickEvent): void {
10-
const paths = e.path;
10+
const paths = e.composedPath() as HTMLElement[];
1111
for (let i = 0; i < paths.length; i++) {
1212
const path = paths[i];
1313
if (path.classList.contains(`${ns.b()}-horizontal`)) {

packages/devui-vue/devui/menu/src/composables/use-layer-operate.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ function getRoot(path: HTMLElement[]): HTMLElement {
9898
function clearSelect_isHorizontal(ele: HTMLElement, event: clickEvent) {
9999
let element = event.target as HTMLElement;
100100
let stack: Element[] = [];
101-
const { path } = event;
102-
const root = getRoot(path as HTMLElement[]);
101+
const root = getRoot(event.composedPath() as HTMLElement[]);
103102
stack = [...Array.from(root.children)] as HTMLElement[];
104103
if (element.tagName === 'SPAN') {
105104
element = element.parentElement as HTMLElement;

0 commit comments

Comments
 (0)