fix bug of AutoComplete that can not blur when click outside

fix bug of AutoComplete that can not blur when click outside
This commit is contained in:
mo.duan 2019-09-06 15:05:06 +08:00
parent 8a93e8b53e
commit 6b285b78ed
4 changed files with 9 additions and 2 deletions

View file

@ -14,6 +14,7 @@
auto-complete
:remote-method="remoteMethod"
@on-change="handleChange"
@on-clickoutside="handleClickOutside"
:transfer="transfer">
<slot name="input">
<i-input
@ -168,6 +169,11 @@
this.currentValue = '';
this.$refs.select.reset();
this.$emit('on-clear');
},
handleClickOutside(){
this.$nextTick(() => {
this.$refs.input.blur();
});
}
}
};

View file

@ -544,6 +544,7 @@
event.preventDefault();
this.hideMenu();
this.isFocused = true;
this.$emit('on-clickoutside', event);
} else {
this.caretPosition = -1;
this.isFocused = false;