3👍
First argument in v-for
is the value
and second is the key
.
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
- [Vuejs]-Vue.js 2.6 use :to="leading to a component " and :href="leading to a web page" at the same time, is it possible?
- [Vuejs]-Is there a quicker way to copy a value in a key of data object to a new key in the same data object in javascript?
Source:stackexchange.com