Created
September 3, 2019 16:05
-
-
Save jedrekk/778226076a22ef0f762c0a51b02292c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue' | |
export default new Vue() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import EventBus from '@/services/event-bus' | |
export default { | |
name: 'NewPopover', | |
computed: {}, | |
watch: { | |
showPopper (newVal, oldVal) { | |
if (newVal) { | |
this.disableBusListener() | |
EventBus.$emit('close-all-popovers') | |
setTimeout(this.enableBusListener, 10) | |
} else { | |
this.disableBusListener() | |
} | |
} | |
}, | |
beforeDestroy () { | |
this.disableBusListener() | |
}, | |
methods: { | |
disableBusListener () { | |
EventBus.$off('close-all-popovers') | |
}, | |
enableBusListener () { | |
EventBus.$on('close-all-popovers', () => { | |
console.log('got close-all-popovers event') | |
this.showPopper = false | |
}) | |
}, | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment