Fixed #7 - Refactor on multiSelect

pull/12/head
mertsincan 2019-05-03 13:37:34 +03:00
parent 57b5d60274
commit beafc5a03f
1 changed files with 4 additions and 1 deletions

View File

@ -251,7 +251,7 @@ export default {
bindOutsideClickListener() { bindOutsideClickListener() {
if (!this.outsideClickListener) { if (!this.outsideClickListener) {
this.outsideClickListener = (event) => { this.outsideClickListener = (event) => {
if (this.overlayVisible && this.$refs.overlay && !this.$refs.overlay.contains(event.target)) { if (this.overlayVisible && this.isOutsideClicked(event)) {
this.overlayVisible = false; this.overlayVisible = false;
} }
}; };
@ -264,6 +264,9 @@ export default {
this.outsideClickListener = null; this.outsideClickListener = null;
} }
}, },
isOutsideClicked(event) {
return !(this.$refs.container.isSameNode(event.target) || this.$refs.container.contains(event.target) || (this.$refs.overlay && this.$refs.overlay.contains(event.target)));
},
getLabelByValue(val) { getLabelByValue(val) {
let label = null; let label = null;