0👍
Don’t put your id
on your body since your script is within your body too. Use a div
instead :
<body>
<div id="test">
<form v-on:submit="send">
<input>
<button>Send</button>
</form>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.2.6/vue.min.js"></script>
<script>
new Vue({
el: '#test',
methods: {
send: function(e) {
alert('test');
e.preventDefault();
}
}
})
</script>
Source:stackexchange.com