浏览代码

Select: debounce query (#12181)

hetech 7 年之前
父节点
当前提交
7f2510f0f1
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      packages/select/src/select.vue

+ 5 - 2
packages/select/src/select.vue

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