Fix autocomplete opening/closing
This commit is contained in:
parent
427b869297
commit
f8620d9ad8
2 changed files with 4 additions and 6 deletions
|
@ -8,6 +8,7 @@
|
||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
:size="size"
|
:size="size"
|
||||||
:placement="placement"
|
:placement="placement"
|
||||||
|
:value="currentValue"
|
||||||
filterable
|
filterable
|
||||||
remote
|
remote
|
||||||
auto-complete
|
auto-complete
|
||||||
|
@ -146,22 +147,19 @@
|
||||||
},
|
},
|
||||||
handleChange (val) {
|
handleChange (val) {
|
||||||
this.currentValue = val;
|
this.currentValue = val;
|
||||||
this.$refs.select.model = val;
|
|
||||||
this.$refs.input.blur();
|
this.$refs.input.blur();
|
||||||
this.$emit('on-select', val);
|
this.$emit('on-select', val);
|
||||||
},
|
},
|
||||||
handleFocus (event) {
|
handleFocus (event) {
|
||||||
this.$refs.select.visible = true;
|
|
||||||
this.$emit('on-focus', event);
|
this.$emit('on-focus', event);
|
||||||
},
|
},
|
||||||
handleBlur (event) {
|
handleBlur (event) {
|
||||||
this.$refs.select.visible = false;
|
|
||||||
this.$emit('on-blur', event);
|
this.$emit('on-blur', event);
|
||||||
},
|
},
|
||||||
handleClear () {
|
handleClear () {
|
||||||
if (!this.clearable) return;
|
if (!this.clearable) return;
|
||||||
this.currentValue = '';
|
this.currentValue = '';
|
||||||
this.$refs.select.model = '';
|
this.$refs.select.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -346,7 +346,7 @@
|
||||||
const selectedSlotOption = autoCompleteOptions[currentIndex];
|
const selectedSlotOption = autoCompleteOptions[currentIndex];
|
||||||
|
|
||||||
return slotOptions.map(node => {
|
return slotOptions.map(node => {
|
||||||
if (node === selectedSlotOption) return applyProp(node, 'isFocused', true);
|
if (node === selectedSlotOption || getNestedProperty(node, 'componentOptions.propsData.value') === this.value) return applyProp(node, 'isFocused', true);
|
||||||
return copyChildren(node, (child) => {
|
return copyChildren(node, (child) => {
|
||||||
if (child !== selectedSlotOption) return child;
|
if (child !== selectedSlotOption) return child;
|
||||||
return applyProp(child, 'isFocused', true);
|
return applyProp(child, 'isFocused', true);
|
||||||
|
@ -467,7 +467,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleMenu (e, force) {
|
toggleMenu (e, force) {
|
||||||
if (this.disabled || this.autoComplete) {
|
if (this.disabled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue