mirror of https://github.com/ElemeFE/element
Select: remove unnecessary query when focused
parent
b206747ed0
commit
3c942d8e93
|
@ -181,7 +181,7 @@
|
||||||
|
|
||||||
destroyed() {
|
destroyed() {
|
||||||
// if appendToBody is true, remove DOM node after destroy
|
// if appendToBody is true, remove DOM node after destroy
|
||||||
if (this.appendToBody && this.$el) {
|
if (this.appendToBody && this.$el && this.$el.parentNode) {
|
||||||
this.$el.parentNode.removeChild(this.$el);
|
this.$el.parentNode.removeChild(this.$el);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,7 +278,7 @@
|
||||||
selectedLabel: '',
|
selectedLabel: '',
|
||||||
hoverIndex: -1,
|
hoverIndex: -1,
|
||||||
query: '',
|
query: '',
|
||||||
previousQuery: '',
|
previousQuery: null,
|
||||||
inputHovering: false,
|
inputHovering: false,
|
||||||
currentPlaceholder: ''
|
currentPlaceholder: ''
|
||||||
};
|
};
|
||||||
|
@ -323,6 +323,7 @@
|
||||||
this.$refs.input.blur();
|
this.$refs.input.blur();
|
||||||
}
|
}
|
||||||
this.query = '';
|
this.query = '';
|
||||||
|
this.previousQuery = null;
|
||||||
this.selectedLabel = '';
|
this.selectedLabel = '';
|
||||||
this.inputLength = 20;
|
this.inputLength = 20;
|
||||||
this.resetHoverIndex();
|
this.resetHoverIndex();
|
||||||
|
@ -382,6 +383,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') {
|
||||||
|
this.previousQuery = val;
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.previousQuery = val;
|
this.previousQuery = val;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
if (this.visible) this.broadcast('ElSelectDropdown', 'updatePopper');
|
if (this.visible) this.broadcast('ElSelectDropdown', 'updatePopper');
|
||||||
|
|
Loading…
Reference in New Issue