I'm using vue-select. When I load the form, the item in the dropdown is not selected. When I open the dropdown, the first item is selected:

When i select an item, and the reopen the dropdown, the item is selected (as expected)

<div class="col-lg-6">
<div class="form-group row">
<label for="customer" class="col-sm-2 col-form-label">Kunde</label>
<div class="col-sm-10">
<v-select :options="customers" :reduce="name => name.id" v-model="form.customer_id" id="customer" label="name" placeholder="Kunde" :class="$vSelectStyle($v.form.customer_id)"></v-select>
<template v-if="$v.form.customer_id.$error" >
<p class="text-danger" v-if="!$v.form.customer_id.required">
Name ist erforderlich!
</p>
</template>
</div>
</div>
</div>
What i have to do that the item is selected the first time?
Just add the style/css to the selected..
.vs__dropdown-option--selected {
background-color: red !important;
}
See sample here: Fiddle
This also works in multiple.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With