Prevent form submitting when pressing enter from a text input, using Vue.js
The submit is always fired on keydown. So use keydown instead of keyup.
<input type="text" v-on="keydown:addCategory | key 'enter'">
Here's a solution for Vue.js 2.x:
<input type='text' v-on:keydown.enter.prevent='addCategory' />
why dont just disable the form submission ?
<form v-on:submit.prevent><input .../></form>
You can use for disable the submit event:
<form @submit.prevent="">
and then when you need to do a form submit use something like this:
<button type="submit" @click="mySubmitMethod"> Send </button>