0π
β
I would like to access all the items so I can display the quantity of
them all.
That is a data operation, not a DOM operation. You donβt get your data from the DOM. It is in your viewmodel. As you figured out (and noted in your comment), you can make a computed
.
0π
You need to get access from the parent. You can put the v-for on a template tag, and do your iteration there.
<template v-for="item in cart.items">
<li >
<h1>{{ item.product.name }}</h1>
</li>
<p>{{ item.product.name }}</p>
</template>
This allows you access to each item. See: Templates and v-for
Source:stackexchange.com