<div id="app">
<form action="#" @submit="send">
<input type="text" name="name" v-model="name">
<input type="text" name="surname" v-model="surname">
<button>Отправить</button>
</form>
<pre>{{message}}</pre>
</div>
const app = new Vue({
el: '#app',
data() {
return {
name: '',
surname: '',
message: {}
}
},
methods: {
send (e) {
e.preventDefault();
this.message = {
body: {
name: this.name,
surname: this.surname
}
}
}
}
})
This Pen doesn't use any external CSS resources.