[Vuejs]-V-model with nested objects, accidentally reactivelly changing half array instead of single item

1👍

The problem is that you’re assigning an object as player.type in your options.

replace option with option.color (or some other non-object key) and it will work

TL;RD;

instead of

<select v-model="player.type">
  <option :value="option" v-for="option in playerOptions">{{option.color}}</option>
</select>

use

<select v-model="player.type">
  <option :value="option.color" v-for="option in playerOptions">{{option.color}}</option>
</select>
👤Daniel

Leave a comment