[Vuejs]-Set default selected item in select input using Vue.js

3👍

First argument in v-for is the value and second is the key.

Documentation.

So this should work:

<option v-for="(value, key) in languages" :key="key" :value="value">

You have an example in i18n‘s docs.


Or, since you want to use the values as keys (as they’re unique & primitives):

<option v-for="lang in languages" :key="lang" :value="lang">
👤tao

Leave a comment