data() {
return {
qty_to_order: null,
}
},
methods: {
showQty(product_id) {
this.carts.filter(function(cart) {
if (cart.product_id === product_id) {
this.qty_to_order = cart.qty_to_order
}
})
}
}
When I call the method, I get an error. How to write cart.qty_to_order to this.qty_to_order (in data) ?
This method works
showQty(product_id) {
this.carts.filter(function(cart) {
if (cart.product_id === product_id) {
console.log(cart.qty_to_order)
}
})
}
New contributor
Stnslv Logit is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.