Просмотр исходного кода

fix: support modifier combination of click.right + .once (#8492)

HcySunYang 7 лет назад
Родитель
Сommit
eb604529c6
1 измененных файлов с 12 добавлено и 12 удалено
  1. 12 12
      src/compiler/helpers.js

+ 12 - 12
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