Here is a simple method to handle alerts using $emit
. But when passing arguments, it seems like the event is not being triggered at all. The goal is to update the value of alert
with the result.
Listening for the event on mount:
this.$eventHub.$on('alert', data =>
this.alert = data
})
Works as Expected:
The value of this.alert
is set even though it was initially undefined.
this.$eventHub.$emit('alert')
Doesn't Work:
The value of this.alert
remains unchanged and the event is not recognized.
this.$eventHub.$emit('alert', {'message':'Signal Test', 'color':'error'})
What could be causing this behavior?