1👍
allProducts
is object with property products
, so in order to loop products try product in allProducts.products
const app = Vue.createApp({
data() {
return {
allProducts: {
products: [
{brand: 'aaa'}, {brand: 'bbb'}
]
}
};
},
})
app.mount('#demo')
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
<div id="demo">
<div v-for="product in allProducts.products">
{{ product.brand }}
</div>
</div>
Source:stackexchange.com