I have faced an issue when doing a simple shopping cart app in vue js 2 Here is the code I have:
blank cart item array for when I press add to cart button then that particular product will be pushed in this array.
data () {
return {
cartItems: []
}
}
add to cart method:
methods: {
addToCart (product) {
product.quantity += 1
this.cartItems.push(product)
}
}
Template view:
<ul>
<li v-for="item in items">
<pre>
{{item.name}} -- {{item.quantity}}
</pre>
</li>
</ul>
in the browser, I got this:
note: right side 1 and 2 value is the quantity of that product but I want something like this.
note: right side 1 and 2 value is the quantity of that product
If I use vue js 1 instead of vue js 2 then same code gives me browser view like 2nd screenshot I attached.
Please, anybody, help me to solve this.

