[Vuejs]-Why im getting this error Elements in iteration expect to have 'v-bind:key' directives

1👍

add key prop in this tag

 <option  v-for="myClass in classes" :value="myClass">{{ myClass }}
    
  </option>

1👍

https://v2.vuejs.org/v2/guide/list.html#Maintaining-State

Add unique id field in :key""

<option v-for="(myClass, idx) in classes" :value="myClass" v-bind:key="idx">
 {{ myClass }}
</option>

0👍

Seems key prop is missing here

 <option  v-for="myClass in classes" :value="myClass">{{ myClass }}
    
  </option>

0👍

You have another v-for directive and you didn’t define the key

<option  v-for="myClass in classes" :value="myClass">{{ myClass }}</option>

it should be like this

<option  v-for="( myClass, i ) in classes" :key="i" :value="myClass">{{ myClass }}</option>

Leave a comment