I'm trying to loop through the variants and retrieve data from the colors array.
I believe my loop code is incorrect
<span v-for="{items, index} in product.variants" :key="index">
<em v-for="(item, index) in items.colors" :key="index">{{ item.name }}</em>
</span>
This is my JSON object:
"variants": [
{
"size": "39",
"colors": [
{
"name": "Red",
"stock": 2
},
{
"name": "Black",
"stock": 1
}
]
},
{
"size": "39",
"colors": [
{
"name": "Red",
"stock": 2
},
{
"name": "Black",
"stock": 1
}
]
}
]
Could someone assist me on how to achieve this?