19 lines
295 B
JavaScript
19 lines
295 B
JavaScript
|
const app = Vue.createApp({
|
||
|
data() {
|
||
|
return {
|
||
|
cart: [],
|
||
|
}
|
||
|
},
|
||
|
methods: {
|
||
|
addToCart(item) {
|
||
|
this.cart.push(item)
|
||
|
},
|
||
|
removeFromCart(item) {
|
||
|
index = this.cart.indexOf(item)
|
||
|
if (index > -1) {
|
||
|
this.cart.splice(index, 1)
|
||
|
}
|
||
|
},
|
||
|
},
|
||
|
})
|