two event bus not working



  • I have the following two eventbus from two different components but when I listen to those two events, only the event bus on the parent component will receive the data and the event on the other component will not receive the data. Hope everybody help please

    mounted () {
            this.$root.$on('busData', data => {
                this.itemHotels = data
                console.log(data)
            })
            this.$root.$on('test', data => {
                this.itemHotels = data
                console.log(this.data)
            })
        },
        beforeDestroy () {
            this.$root.$off('busData', this.itemHotels)
            this.$root.$off('test', this.itemHotels)
        }
    

Log in to reply