[Vuejs]-How to catch input after enter in VUE?

0👍

You can extract key value from keyboard event which is passed to function. Following is fiddle: https://jsfiddle.net/brijkishor/bokcrzwt/6/

JS:
new Vue({
  el: '#app',
  data: {
    message: 'Input key press',
    name: ''
  },
  methods: {
    find: function(keyEvent) {
      console.log("key entered: ", keyEvent.key, ' : name: ', this.name);
    }
  }
})
// HTML
<div id="app">
  <input type="text" v-model="name" v-on:keydown="find">
  name: {{name}}
</div>

0👍

Solved, have a look here https://jsfiddle.net/0phLz311/6/ don’t forget to open DevTools console to see the expected behaviour of the method find.

Leave a comment