fix #4273
This commit is contained in:
parent
7a2155098f
commit
47f03c5419
2 changed files with 15 additions and 2 deletions
|
@ -155,6 +155,7 @@
|
||||||
},
|
},
|
||||||
resetInputState () {
|
resetInputState () {
|
||||||
this.inputLength = this.$refs.input.value.length * 12 + 20;
|
this.inputLength = this.$refs.input.value.length * 12 + 20;
|
||||||
|
this.$emit('on-keydown');
|
||||||
},
|
},
|
||||||
handleInputDelete () {
|
handleInputDelete () {
|
||||||
if (this.multiple && this.selectedMultiple.length && this.query === '') {
|
if (this.multiple && this.selectedMultiple.length && this.query === '') {
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
@on-input-focus="isFocused = true"
|
@on-input-focus="isFocused = true"
|
||||||
@on-input-blur="isFocused = false"
|
@on-input-blur="isFocused = false"
|
||||||
@on-clear="clearSingleSelect"
|
@on-clear="clearSingleSelect"
|
||||||
|
|
||||||
|
@on-keydown="handleFilterInputKeyDown"
|
||||||
/>
|
/>
|
||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
|
@ -264,6 +266,7 @@
|
||||||
unchangedQuery: true,
|
unchangedQuery: true,
|
||||||
hasExpectedValue: false,
|
hasExpectedValue: false,
|
||||||
preventRemoteCall: false,
|
preventRemoteCall: false,
|
||||||
|
filterQueryKeyDown: false, // #4273
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -392,7 +395,7 @@
|
||||||
if (cOptions.children.length > 0) selectOptions.push({...option});
|
if (cOptions.children.length > 0) selectOptions.push({...option});
|
||||||
} else {
|
} else {
|
||||||
// ignore option if not passing filter
|
// ignore option if not passing filter
|
||||||
if (!hasDefaultSelected) {
|
if (!hasDefaultSelected || this.filterQueryKeyDown) {
|
||||||
const optionPassesFilter = this.filterable ? this.validateOption(cOptions) : option;
|
const optionPassesFilter = this.filterable ? this.validateOption(cOptions) : option;
|
||||||
if (!optionPassesFilter) continue;
|
if (!optionPassesFilter) continue;
|
||||||
}
|
}
|
||||||
|
@ -402,6 +405,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.filterQueryKeyDown = false;
|
||||||
|
|
||||||
return selectOptions;
|
return selectOptions;
|
||||||
},
|
},
|
||||||
flatOptions(){
|
flatOptions(){
|
||||||
|
@ -658,7 +663,14 @@
|
||||||
if (this.getInitialValue().length > 0 && this.selectOptions.length === 0) {
|
if (this.getInitialValue().length > 0 && this.selectOptions.length === 0) {
|
||||||
this.hasExpectedValue = true;
|
this.hasExpectedValue = true;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
/**
|
||||||
|
* 下面的方法,当 filterable 时,输入内容时,标记,用于区分和直接选择而引起的 bug
|
||||||
|
* #4273
|
||||||
|
* */
|
||||||
|
handleFilterInputKeyDown () {
|
||||||
|
this.filterQueryKeyDown = true;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
value(value){
|
value(value){
|
||||||
|
|
Loading…
Add table
Reference in a new issue