Communication between sibling components in VueJs 2.0

Communication between sibling components in VueJs 2.0

Asked on November 19, 2018 in vue.js.
Add Comment


  • 1 Answer(s)

    We can simply try short and use root vue case as global even hub:

    Element 1:

    this.$root.$emit('eventing', data);
    

    Element 2:

    mounted() {
        this.$root.$on('eventing', data => {
            console.log(data);
        });
    }
    
    Answered on November 19, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.