-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Description
What problem does this feature solve?
我需要给一个DIV绑定keydown事件,可是我在组件中对该DIV加了tabindex="0"属性后,依然无法成功使用addEventListener方法或者div.onkeydown=function(){……}的方式成功绑定。这是不是VUE的一个BUG?
如果是纯JS原生环境下,对DIV加入tabindex="0"属性,是可以绑定键盘事件的。
例子:
<div style="width:100px;height:100px;background:#000" @keydown="renderKeydown($event)">
……
renderKeydown(e){
console.log('e.keyCode', e.keyCode);
},
////结果连'e.keyCode'字样都没有输出。
What does the proposed API look like?
能在VUE下成功的对DIV,SPAN等元素绑定键盘事件。
Metadata
Metadata
Assignees
Labels
No labels