facing this problem? So do I. Vuejs already solve this problem by adding .number on v-model
this will help addition do the right thing.
code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>VUE JS</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script>
</head>
<body>
<div id='app' class="container">
<br>
<form>
<label for="firstNumber">First Number</label>
<input type="number" id="firstNumber" v-model.number="firstNumber">
<br/>
<label for="secondNumber">Second Number</label>
<input type="number" id="secondNumber" v-model.number="secondNumber">
<br/>
<label for="result">Result</label>
<input type="number" id="result" v-model.number="result">
</form>
</div>
<script>
new Vue({
el: '#app',
data: {
firstNumber: '',
secondNumber: ''
},
computed: {
result: function() {
return this.firstNumber + this.secondNumber;
}
}
});
</script>
</body>
</html>