add remove product
This commit is contained in:
parent
83f25f7972
commit
70d6c23d47
2 changed files with 9 additions and 2 deletions
|
|
@ -124,10 +124,10 @@ async function customerStall(path) {
|
|||
this.cart.products = prod
|
||||
this.updateCart(+item.price)
|
||||
},
|
||||
removeFromCart(item) {
|
||||
removeFromCart(item, del = false) {
|
||||
let prod = this.cart.products
|
||||
let qty = prod.get(item.id).quantity
|
||||
if (qty == 1) {
|
||||
if (qty == 1 || del) {
|
||||
prod.delete(item.id)
|
||||
} else {
|
||||
prod.set(item.id, {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,13 @@ async function shoppingCart(path) {
|
|||
'remove-from-cart',
|
||||
this.products.find(p => p.id == id)
|
||||
)
|
||||
},
|
||||
removeProduct(id) {
|
||||
this.$emit(
|
||||
'remove-from-cart',
|
||||
this.products.find(p => p.id == id),
|
||||
true
|
||||
)
|
||||
}
|
||||
},
|
||||
created() {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue