vuejs enter event code example
Example 1: enter key vue
<!-- only call `vm.submit()` when the `key` is `Enter` -->
<input v-on:keyup.enter="submit()">
<input @keyup.enter="submit()">
vue
Example 2: Vuejs v-model when enter pressed
<input type="text" v-on:keyup.enter="submit" />
<p> {{ outputValueOnEnter }} </p>
outputValueOnEnter = ''
submit(e) {
this.outputValueOnEnter = e.target.value
e.target.value = ''
}
Example 3: vue js button click
<div id="example-2">
<!-- `greet` is the name of a method defined below -->
<button v-on:click="greet">Greet</button>
</div>