Skip to content

Commit c3221c3

Browse files
HcySunYangaJean
authored andcommitted
fix: support modifier combination of click.right + .once (vuejs#8492)
1 parent 0ec7b00 commit c3221c3

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/compiler/helpers.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ export function addHandler (
6565
)
6666
}
6767

68+
// normalize click.right and click.middle since they don't actually fire
69+
// this is technically browser-specific, but at least for now browsers are
70+
// the only target envs that have right/middle clicks.
71+
if (name === 'click') {
72+
if (modifiers.right) {
73+
name = 'contextmenu'
74+
delete modifiers.right
75+
} else if (modifiers.middle) {
76+
name = 'mouseup'
77+
}
78+
}
79+
6880
// check capture modifier
6981
if (modifiers.capture) {
7082
delete modifiers.capture
@@ -80,18 +92,6 @@ export function addHandler (
8092
name = '&' + name // mark the event as passive
8193
}
8294

83-
// normalize click.right and click.middle since they don't actually fire
84-
// this is technically browser-specific, but at least for now browsers are
85-
// the only target envs that have right/middle clicks.
86-
if (name === 'click') {
87-
if (modifiers.right) {
88-
name = 'contextmenu'
89-
delete modifiers.right
90-
} else if (modifiers.middle) {
91-
name = 'mouseup'
92-
}
93-
}
94-
9595
let events
9696
if (modifiers.native) {
9797
delete modifiers.native

0 commit comments

Comments
 (0)