From 351a4ba1fa0313a90f3ae870b2a93e4c23e007eb Mon Sep 17 00:00:00 2001 From: HcySunYang Date: Sat, 14 Jul 2018 23:51:51 +0800 Subject: [PATCH] refactor: support for the use of modifiers such as click.right.once --- src/compiler/helpers.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/compiler/helpers.js b/src/compiler/helpers.js index 6a7375a3080..265b05c0390 100644 --- a/src/compiler/helpers.js +++ b/src/compiler/helpers.js @@ -65,6 +65,18 @@ export function addHandler ( ) } + // normalize click.right and click.middle since they don't actually fire + // this is technically browser-specific, but at least for now browsers are + // the only target envs that have right/middle clicks. + if (name === 'click') { + if (modifiers.right) { + name = 'contextmenu' + delete modifiers.right + } else if (modifiers.middle) { + name = 'mouseup' + } + } + // check capture modifier if (modifiers.capture) { delete modifiers.capture @@ -80,18 +92,6 @@ export function addHandler ( name = '&' + name // mark the event as passive } - // normalize click.right and click.middle since they don't actually fire - // this is technically browser-specific, but at least for now browsers are - // the only target envs that have right/middle clicks. - if (name === 'click') { - if (modifiers.right) { - name = 'contextmenu' - delete modifiers.right - } else if (modifiers.middle) { - name = 'mouseup' - } - } - let events if (modifiers.native) { delete modifiers.native