Moving away from this.$root.$on and this.$root.$off
Docs say to use mitt but not working for Vue2?
Component One
mounted() {
emitter.on('doThis', (id) => this.doThis(id));
}
destroyed() {
emitter.off('doThis', (id) => this.doThis(id))
}
methods: {
doThis(id) {
console.log(id)
}
}
Component Two
handleClick() {
emitter.emit('doThis', this.item.id);
}