[Vuejs]-Input delay in vue-select

0๐Ÿ‘

I came up with adding lodash.debouncer.
For interest, following my solution:

 <vSelect
        class="my-select"
        @search="loadDebouncer"
        :filterable="false"
        :options="options"
        label="myLabel"
        v-model="selectedVal"
        :disabled="disabled"
    >
import { Component, Vue, Prop, Watch } from 'vue-property-decorator';
import debounce from 'lodash.debounce';

@Component
export default class MySelect extends Vue{
    public loadDebouncer = debounce((searchString, loading) => this.fetchOptions(searchString, loading), 500);

    public async fetchOptions(searchString: string, loading:any){
        //Load my list
    }
}

Leave a comment