feat: Add quantity controls to cart with +/- buttons
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
:currency="currency"
|
||||
@remove="removeFromCart"
|
||||
@checkout="goToCheckout"
|
||||
@update-quantity="updateCartQuantity"
|
||||
/>
|
||||
</div>
|
||||
</v-col>
|
||||
@@ -98,6 +99,16 @@ export default {
|
||||
item.quantity = 0;
|
||||
}
|
||||
},
|
||||
updateCartQuantity({ itemId, quantity }) {
|
||||
const cartItem = this.cartItems.find(i => i.id === itemId);
|
||||
if (cartItem) {
|
||||
cartItem.quantity = quantity;
|
||||
}
|
||||
const productItem = this.items.find(i => i.id === itemId);
|
||||
if (productItem) {
|
||||
productItem.quantity = quantity;
|
||||
}
|
||||
},
|
||||
goToCheckout() {
|
||||
this.$router.push('/comprar');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user