Limit search characters before making the search request

This commit is contained in:
fayazara 2022-12-15 19:06:56 +05:30
parent d038a93d65
commit 785b303166

View file

@ -39,7 +39,9 @@ export default {
this.searchQuery = e.target.value; this.searchQuery = e.target.value;
clearTimeout(this.debounce); clearTimeout(this.debounce);
this.debounce = setTimeout(async () => { this.debounce = setTimeout(async () => {
this.$emit('search', this.searchQuery); if (this.searchQuery.length > 2) {
this.$emit('search', this.searchQuery);
}
}, 500); }, 500);
}, },
focusSearch(e) { focusSearch(e) {