Static GitHub Issues

[849] Event handling in different components ($emit and $on)

prev: async/await in nuxt.config.js
next: Are getters supported in modules mode?

I have a very simple use case. Emit an event in one component and listen to that event in another component. In component1's methods block, I am using this piece of code

this.$emit('deletedchip')

In component2's mounted block, I am using this piece of code

this.$on('deletedchip', function(){
//Do something
}) 

Event is being emitted but the listener part in component2 is not working. Is there any specific way of dealing this in nuxtjs ?

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c728">#c728</a>)</em></sub></div>