Erdi
Erdi

Reputation: 1884

Vue.js / Vuex click function is not working for cmd + click

I want to fire a function for cmd + click. But it looks impossible at least for my keyboard.

My keyboard type:

Macbook Turkish Q

It seems like because of Macbook CMD key works depend on browser, How can I set new key codes for vue.js easily?

<div @click="foo($event)" ></div>

foo(e){
console.log(e.ctrlKey) // If I press CMD and Click to DIV result always FALSE
console.log(e.shiftKey) // If I press SHIFT and Click to DIV result TRUE (shift working but cmd is not working)
}

Upvotes: 1

Views: 1673

Answers (1)

Erdi
Erdi

Reputation: 1884

If you check e.metaKey it works! it handles CMD now.

Thank you.

Upvotes: 4

Related Questions