Enter with @keyup event not working in Vue Enter with @keyup event not working in Vue vue.js vue.js

Enter with @keyup event not working in Vue


The click event already triggers with the ENTER key (it also triggers with Space in some browsers, like Chrome for desktop). So, your code only needs a @click="callEvent" and everything works well since the focus is already on the button:

var app = new Vue({  el: "#app",  methods: {    callEvent() {      console.log("Event called");    }  }});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.2/vue.min.js"></script><div id="app">  <button @click="callEvent">Enter</button></div>