Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't use camelCase property name when define and use Vue.config.keyCodes

Can't use camelCase property name when define and use Vue.config.keyCodes

I am trying to config keyCodes on keyup event Using v-on by Vue.js.
I read the documentation and found Vue.config.keyCodes = {} which is static method user can set custom names to keyCodes.


Problem 1 : camelCase property name seems not working.

below is JSFiddle without camelCase and it works well.

Link : without camelCase config

below is JSFiddle with camelCase and it does not work.

Link : with camelCase config

There is example using camelCase in Vue.js documentation.
I think camelCase should work too. why it is not working??

Problem 2 : binding multiple keyCodes

I want to make my input to Alert when I type cmd + enter.
I tried @keyup.91.13, @keyup.91&&13, or keyCode config like

Vue.config.keyCodes = {
    hit: 91&&13
}

but it does not work. How can I make this work properly??

like image 654
KHW1031 Avatar asked Dec 29 '25 13:12

KHW1031


1 Answers

Problem 2 : binding multiple keyCodes

Better to use ".meta" because "keyup = 91" don't works for Opera (its "keyup=219" and not 91).

@keyup.meta.enter="yourMethod"

(But I don't know why this don't works for me on Ubuntu)

Note: On Macintosh keyboards, meta is the command key (⌘). On Windows keyboards, meta is the windows key (⊞). On Sun Microsystems keyboards, meta is marked as a solid diamond (◆). On certain keyboards, specifically MIT and Lisp machine keyboards and successors, such as the Knight keyboard, space-cadet keyboard, meta is labeled “META”. On Symbolics keyboards, meta is labeled “META” or “Meta”.

like image 172
Happyriri Avatar answered Jan 01 '26 15:01

Happyriri