Trying to figure out how to calculate the Total Tax Amount after an input using Vuejs in a Laravel application. The function on my computer that is supposed to calculate the total isn't working as expected. Can anyone spot where the issue might be?
Here is the Vuejs code snippet:
var app = new Vue({
el: '#app',
data: {
rinvoices: {
amount:'',
tva:'',
},
},
methods: {
addRinvoice: function () {
axios.post('/addrinvoice', this.rinvoices)
.then(response => {
console.log(response.data);
if (response.data.etat) {
this.rinvoices = {
id: 0,
amount: response.data.etat.amount,
tva: response.data.etat.tva,
};
}
})
},
},
computed: {
total: function () {
var amount= this.rinvoices.amount;
var tax= this.rinvoices.tva;
var taxamount= amount*tax;
var t=taxamount + amount;
return t;
}
},
});
The problem is that my function is not calculating taxamount + amount, instead it's displaying the values separately as taxamount and Amount. For example, instead of showing 10+5=15, it shows 10 5.