Vue: when to use @keyup.native in input elements
Based on your comments, I'm assuming that you're using the Vue Material libary and the <md-input>
component instead of an <input>
element.
If you listen to the keyup
event without using the .native
modifier (via <md-input @keyup.enter="doFilter">
), then your component is waiting for the <md-input>
component to emit a custom keyup
event.
But, that component does not emit a keyup
event, so the doFilter
method will never be called.
As the documentation states, adding the .native
modifier will make the component listen for a "native event on the root element" of the <md-input>
component.
So, <md-input @keyup.native.enter="doFilter">
will listen to the native keyup
DOM event of the root element of the <md-input>
component and call the doFilter
method when that is triggered from the Enter key.