소스 검색

Select: remove unnecessary remote query when focused (#9998)

杨奕 7 년 전
부모
커밋
62b0e2ace9
2개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      packages/select/src/select.vue
  2. 1 0
      test/unit/specs/select.spec.js

+ 4 - 1
packages/select/src/select.vue

@@ -406,7 +406,10 @@
     methods: {
       handleQueryChange(val) {
         if (this.previousQuery === val) return;
-        if (this.previousQuery === null && typeof this.filterMethod === 'function') {
+        if (
+          this.previousQuery === null &&
+          (typeof this.filterMethod === 'function' || typeof this.remoteMethod === 'function')
+        ) {
           this.previousQuery = val;
           return;
         }

+ 1 - 0
test/unit/specs/select.spec.js

@@ -626,6 +626,7 @@ describe('Select', () => {
       remoteMethod
     });
     const select = vm.$children[0];
+    select.handleQueryChange('');
     vm.$nextTick(() => {
       select.handleQueryChange('面');
       setTimeout(() => {