posva / vue-mdc

Material web components for Vue.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

textfiled on keyup.enter

vicmars5 opened this issue · comments

Hello, I am not sure if is posibble to pass a method to execute when enter key is pressed?, or do i need to modify the textfield component to add the functionallity?.

You can bind a method you provide to the keyup event. For example, use this for the Enter key:

<mdl-textfield @keyup.native.enter="onEnter"></mdl-textfield>
.
.
.
methods: {
    onEnter () {
        .
        .
        .

The .native modifier is needed, and if you want to catch every key, just leave out the .enter modifier in the event binding.