shopping cart add and remove products quantity

This commit is contained in:
Tiago Vasconcelos 2023-03-23 16:34:26 +00:00
parent a28cae039c
commit 83f25f7972
5 changed files with 45 additions and 9 deletions

View file

@ -5,12 +5,32 @@ async function shoppingCart(path) {
name: 'shopping-cart',
template,
props: ['cart', 'cart-menu', 'remove-from-cart', 'reset-cart'],
props: [
'cart',
'cart-menu',
'add-to-cart',
'remove-from-cart',
'reset-cart',
'products'
],
data: function () {
return {}
},
computed: {},
methods: {},
methods: {
add(id) {
this.$emit(
'add-to-cart',
this.products.find(p => p.id == id)
)
},
remove(id) {
this.$emit(
'remove-from-cart',
this.products.find(p => p.id == id)
)
}
},
created() {}
})
}