For a VueJS 2.0 project I have the following on the parent component
I needed to do this for a popover where several could exist and props for each one are inappropriate.
To dispatch global events it is possible to add event listeners to the $root Vue instance.
// Child:
created() {
this.$root.$on('popover', (e) => {
// Determine if popover should close, etc.
this.close()
})
},
// Parent:
this.$emit('popover', 'arg1', 'argn')
Remember to call $off in destroyed
as well.