<div id="app">
Type the first number:
<input type="number" v-model.number="n1"><br />
Type the second number:
<input type="number" v-model.number="n2"><br />
<button v-on:click="sum(n1,n2)">Sum</button><br />
The sum is: {{ ans }}
</div>
var vue = new Vue({
el: "#app",
data: {
n1: 0,
n2: 0,
ans: 0
},
methods: {
sum: function(a, b) {
this.ans = a + b;
}
}
});
This Pen doesn't use any external CSS resources.