Before submitting my form with Axios, I am in need of applying specific discounts to each item within campaign.items.
To achieve this, a functional method has been created:
applyDiscount(price) {
return price - (this.totalDiscount * price)
},
Prior to submission, I am integrating the call to this function inside my submit function:
methods: {
submit() {
this.campaign.items.forEach(function(item) {
this.applyDiscount(item.price)
}),
var data = new FormData()
An error message is being displayed as follows:
Error in v-on handler: "TypeError: Cannot read properties of undefined (reading 'applyDiscount')"