Vue: When To Use @keyup.native In Input Elements October 27, 2023 Post a Comment I have a Vue component with an element that binds the v-on:keyup.enter key to doFilter() a that binds the v-on:click event to doFilter() Solution 1: 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.Baca JugaDatetime From Utc In Local Time FormatWhy Does Queryselector Only Select The First Element And How Can I Fix This?How To Get The Next Obj When Looping In The Django ModelSolution 2: I had the same problem on a custom vue component on which I was listening to both @select and @keyup.native.enter and I was receiving the Enter key twice because I didn't pay attention: onSelect emits an onKeyDown for Enterand onkeyUp flared secondly.My solution was to listen to @keydown.native.enter so that the @select cycle of keys was unbothered (which is keydown -> keypresssed -> keyup). Share You may like these postsHow Do I Change The Arrow Icon Inside The Select Tag With A Fontawesome Icon. I Am Using Vue-cli. I Have Imported Fontawesome In Main.jsCall Method From Component Inside Component's Vuejs 2 - How To Pass Parameters Using $emitHow To Pass Function As A Prop To Child Component And Call It From There In Vue? Post a Comment for "Vue: When To Use @keyup.native In Input Elements"
Post a Comment for "Vue: When To Use @keyup.native In Input Elements"