vue-select
vue-select copied to clipboard
How to create a default option with create-option?
Hi, I was implementing this library and I have read the documentation and I have tried to replicate what create-option is but it never appears or it tells me that the array is wrong.
I have a select that is filled with axios, the issue is that I want to add a default option that the first element says All executives and is not blank.
For example I have users that have a superior role that can view all users and not only themselves, then that is the thing that I want to replicate but it does not let me add the default option All.
<v-select
:options="employees"
:reduce="employees => employees.replacement_user_id"
v-model="filter_current_user"
label="replacement_user_name"
:clearable="false"
input-id="replacement_user_id"
:create-option="defaultSalesman => defaultSalesman.replacement_user_id"
@input="changeSalesman"
>
</v-select>
data(){
return {
defaultSalesman: {replacement_user_id: 'All',replacement_user_name:'All users'}, //I want to add this option as the first line.
employees: [], //It is filled with axios.
filter_current_user: this.user['id']
}
}