Binding keyboard events to non-input elements in vue

input can use @ keyup.enter=XXX () to get focus. Binding other elements has no effect. Do I have to get focus?

Feb.17,2022

non-input element binding keyboard event, you need to add tabindex attribute or set contenteditable attribute to true . concrete example


non-form elements need a tabindex attribute to listen for keyboard events, such as

tabindex='1'

try @ keyup.enter.native

Menu