Select: debounce query (#12181)

pull/12237/head
hetech 2018-08-02 19:28:41 +08:00 committed by GitHub
parent c5347b8064
commit 7f2510f0f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -62,8 +62,7 @@
@compositionupdate="handleComposition" @compositionupdate="handleComposition"
@compositionend="handleComposition" @compositionend="handleComposition"
v-model="query" v-model="query"
@input="e => handleQueryChange(e.target.value)" @input="debouncedQueryChange"
:debounce="remote ? 300 : 0"
v-if="filterable" v-if="filterable"
:style="{ width: inputLength + 'px', 'max-width': inputWidth - 42 + 'px' }" :style="{ width: inputLength + 'px', 'max-width': inputWidth - 42 + 'px' }"
ref="input"> ref="input">
@ -849,6 +848,10 @@
this.onInputChange(); this.onInputChange();
}); });
this.debouncedQueryChange = debounce(this.debounce, (e) => {
this.handleQueryChange(e.target.value);
});
this.$on('handleOptionClick', this.handleOptionSelect); this.$on('handleOptionClick', this.handleOptionSelect);
this.$on('setSelected', this.setSelected); this.$on('setSelected', this.setSelected);
}, },