JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/0.12.4/vue.min.js"></script>
<div id="myVueForm">
<form method="post" id="form">
<p>Try typing something and pressing enter</p>
<input type="text" v-on="keyup: addCategory | key 'enter'" />
<!-- more form fields -->
<br/><br/>
</form>
</div>
JavaScript
new Vue({
el: '#myVueForm',
methods: {
addCategory: function (e) {
if (e) e.preventDefault();
console.log("Added a new category, thanks!");
}
}
});
// Catch the submit event with jquery and show in console.
// This is purely for demonstration purposes to show the form was submitted when it shoudn't have been.
$('#form').submit(function (e) {
console.log("caught the form submit event");
return false;
});