Reputation: 103
How i can load data after click on vue-select, if i do this it's load aftet two click
<v2-select style="width:150px;max-width: 150px"
@click="loadFormats"
:searchable="false"
:clearable="false
"
:options="formats"
v-model="localSelectedFormat.value"
label="nameFormat"
>
</v2-select>
loadFormats(){
this.getFormats().then(res => {
this.formats = res.data;
...
})
Upvotes: 0
Views: 199
Reputation: 17
you can remove the click event and call the loadFormats
function in the mounted
lifecycle hook function.
code below:
<v2-select style="width:150px;max-width: 150px"
:searchable="false"
:clearable="false"
:options="formats"
v-model="localSelectedFormat.value"
label="nameFormat"
>
</v2-select>
mounted(){
this.loadFormats()
}
```
Upvotes: 2