mirror of https://github.com/ElemeFE/element
fix dropdown not show
parent
ed72c389fc
commit
383e3a5f93
|
@ -77,7 +77,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.popperElm = this.$el;
|
this.$parent.popperElm = this.popperElm = this.$el;
|
||||||
this.referenceElm = this.$parent.$refs.input.$refs.input;
|
this.referenceElm = this.$parent.$refs.input.$refs.input;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isFocus: false,
|
activated: false,
|
||||||
isOnComposition: false,
|
isOnComposition: false,
|
||||||
suggestions: [],
|
suggestions: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
suggestionVisible() {
|
suggestionVisible() {
|
||||||
const suggestions = this.suggestions;
|
const suggestions = this.suggestions;
|
||||||
let isValidData = Array.isArray(suggestions) && suggestions.length > 0;
|
let isValidData = Array.isArray(suggestions) && suggestions.length > 0;
|
||||||
return (isValidData || this.loading) && this.isFocus;
|
return (isValidData || this.loading) && this.activated;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -123,20 +123,22 @@
|
||||||
},
|
},
|
||||||
handleChange(value) {
|
handleChange(value) {
|
||||||
this.$emit('input', value);
|
this.$emit('input', value);
|
||||||
|
this.activated = true;
|
||||||
if (this.isOnComposition || (!this.triggerOnFocus && !value)) {
|
if (this.isOnComposition || (!this.triggerOnFocus && !value)) {
|
||||||
this.suggestions = [];
|
this.suggestions = [];
|
||||||
|
this.activated = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.getData(value);
|
this.getData(value);
|
||||||
},
|
},
|
||||||
handleFocus() {
|
handleFocus() {
|
||||||
this.isFocus = true;
|
this.activated = true;
|
||||||
if (this.triggerOnFocus) {
|
if (this.triggerOnFocus) {
|
||||||
this.getData(this.value);
|
this.getData(this.value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
close() {
|
close(e) {
|
||||||
this.isFocus = false;
|
this.activated = false;
|
||||||
},
|
},
|
||||||
handleKeyEnter() {
|
handleKeyEnter() {
|
||||||
if (this.suggestionVisible && this.highlightedIndex >= 0 && this.highlightedIndex < this.suggestions.length) {
|
if (this.suggestionVisible && this.highlightedIndex >= 0 && this.highlightedIndex < this.suggestions.length) {
|
||||||
|
|
Loading…
Reference in New Issue