Skip to content

Select with dynamic options doesn't keep the correct selected option when shift / unshifting options #230

Closed Answered by antman3351
antman3351 asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for the pointer ( a few extra words would have reduced my googling... 😅)

https://vuejs.org/api/built-in-special-attributes.html#key

So the key has to be set like this:

<select v-model="selectedItem">
    <option v-for="item in items" :value="item" :key="item">{{item}}</option>
</select>

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by antman3351
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants