0👍
If the cart is what you are showing on the Dom
Then put manual assignment before the line where u push the item
addToCart(index) {
var item = this.sorted[index];
var findProduct = this.cart.find((o) => o.Name === item.Name);
if (findProduct) {
item.quantity++;
item.totalPrice = item.quantity * item.Price;
this.$set(item, 'quantity', item.quantity++)
return;
} else {
item.quantity = 1;
item.totalPrice = item.quantity * item.Price;
this.cart.push(item);
// this property is not available in JSON file I'm setting it later
}
},
and after updating the items, update the dom using Vue.$nextTick
, hope it will solve your issue.
Source:stackexchange.com