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

pull/10006/head
杨奕 2018-03-05 13:14:12 +08:00 committed by GitHub
parent 067a9be7d1
commit 62b0e2ace9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -406,7 +406,10 @@
methods: { methods: {
handleQueryChange(val) { handleQueryChange(val) {
if (this.previousQuery === val) return; 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; this.previousQuery = val;
return; return;
} }

View File

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