vue 3 enter key code example
Example 1: @keyup.enter vue
<input v-on:keyup.enter="submit">
<!-- Also works like this: -->
<input @keyup.enter="submit">
Example 2: Vuejs v-model when enter pressed
<input type="text" v-on:keyup.enter="submit" />
<p> {{ outputValueOnEnter }} </p>
//In data() :
outputValueOnEnter = ''
// In methods:
submit(e) {
this.outputValueOnEnter = e.target.value
e.target.value = ''
}