fix bug of AutoComplete that can not blur when click outside

This commit is contained in:
梁灏 2019-09-05 18:30:00 +08:00
parent 139c4b518f
commit 9fa451d7c6
5 changed files with 43 additions and 6 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
@ -167,6 +168,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;