0๐
I have recreated your code at jsfiddle. Check it. It working as wanted.
So Ill explain the code .
You need to auto select a default value mean that relevant data property (attached to v-model)should have a value where that value should also available in the option list. So what I have done here is that v-model for b-form-select
will be predefined with null values. If you dont know how many dynamic selections will be there then make that data property dynamically on at the component. Means you can initiate data at mounted/created.
Code
<div id="app">
<div class="w-100">
<b-form-select v-for="(skill,index) in skillsList" v-model="selectedSkills[index]" class="form-control" >
<b-form-select-option value="null" disabled>Choose</b-form-select-option>
<b-form-select-option value="set">Set</b-form-select-option>
<b-form-select-option value="unset">Unset</b-form-select-option>
</b-form-select>
</div>
</div>
Script
data() {
return {
selectedSkills : ['null','null','null'],
skillsList : ['skill 01', 'skill 02', 'skill 03'],
}
},
- [Vuejs]-Vue stating that a property is undefined, when I clearly defined it
- [Vuejs]-Vue 2 โ How / is it possible to create a unique layout during a v-for loop?
Source:stackexchange.com