Quellcode durchsuchen

rename _keyCode -> _k

Evan You vor 10 Jahren
Ursprung
Commit
f0efa9aad2

+ 1 - 1
src/compiler/events.js

@@ -56,7 +56,7 @@ function genKeyFilter (key: string): string {
   const code =
     parseInt(key, 10) || // number keyCode
     keyCodes[key] || // built-in alias
-    `_keyCode(${JSON.stringify(key)})` // custom alias
+    `_k(${JSON.stringify(key)})` // custom alias
   if (Array.isArray(code)) {
     return `if(${code.map(c => `$event.keyCode!==${c}`).join('&&')})return;`
   } else {

+ 1 - 1
src/core/instance/render.js

@@ -154,7 +154,7 @@ export function renderMixin (Vue: Class<Component>) {
   }
 
   // expose v-on keyCodes
-  Vue.prototype._keyCode = key => config.keyCodes[key]
+  Vue.prototype._k = key => config.keyCodes[key]
 }
 
 function resolveSlots (

+ 1 - 1
test/unit/modules/compiler/codegen.spec.js

@@ -231,7 +231,7 @@ describe('codegen', () => {
     // custom keycode
     assertCodegen(
       '<input @input.custom="onInput">',
-      `with(this){return _h(_e('input',{on:{"input":function($event){if($event.keyCode!==_keyCode("custom"))return;onInput($event)}}}))}`
+      `with(this){return _h(_e('input',{on:{"input":function($event){if($event.keyCode!==_k("custom"))return;onInput($event)}}}))}`
     )
   })