I've got an array of colors and would like to bind the css class when the user selects a certain color. I would like to change the color of the select input, depending on the chosen option.
<li v-for="product in products">
<select v-model="product.color">
<option v-for="color in colors" :class="{ color: isActive }">{{ color }}</option>
</select>
</li>
colors: [
{
color: 'white',
isActive: false
},
{
color: 'black',
isActive: false
}
],
products: [
{
color: 'white'
},
{
color: 'white'
}
]
What is the best way to make it work?