I am currently working on a project that involves calculating the total sum of 5 input fields.
I have set up data fields and v-model for each field, and in my computed section I am attempting to calculate the sum.
<input type="text" class="form-control" id="ValorImovelPatrimonio" name="ValorImovelPatrimonio" v-model="ValorImovelPatrimonio" required @keydown="$event.keyCode === 13 ? $event.preventDefault() : false" @blur="pegaTotal">
var vue = new Vue({
el: '#app',
data: {
checked : false,
deposito: 1,
patrimonio_nao: false,
ValorImovelPatrimonio: null,
ValorAutosPatrimonio: null,
ValorOutrosPatrimonio: null,
ValorAcoesPatrimonio: null,
ValorInvestimentosPatrimonio: null,
// total: null
},
...
computed: {
total: function(){
return this.ValorImovelPatrimonio + this.ValorAutosPatrimonio;
}
}
Currently, when I input the following values:
ValorAutosPatrimonio:"15.000"
ValorImovelPatrimonio:"1.500.000"
I expect the total to be:"1.515.000"
However, the actual result shows as:
total:"1.500.00015.000"
If anyone has any insights or suggestions on how to resolve this issue, please let me know!