Hello I would like to put a condition on the name of the option if the object sku.attributes is empty the name is same product otherwise it displays the color and size
skusListProduct = [{attributes:{size:'m', color: 'black'}}] // ex array
<select
v-model="skuList"
@change="productChoice"
>
<option
v-for="sku in skusListProduct"
:key="sku.id"
:value="sku.id"
>
<span v-if="sku.attributes && sku.attributes.length > 0">
{{ sku.attributes.color }} {{ sku.attributes.size }}
</span>
<span v-else>
same product
</span>
</option>
</select>
I'm do that but is doesn't work
I'm resolve my answer check if keys sku.attributes is exist
sku.attributes && Object.keys(sku.attributes).length > 0