[Vuejs]-Vue 2 parent get children component data

0👍

You can use $emit to call parent’s method from child component and pass the variable you want to pass to parent’s method.

Have a look at this answer for more details.

0👍

Since you are using Vuex just make the children do actions that change the state, and make the parent react to such changes by using getters. More info about the last thing here: https://vuex.vuejs.org/en/getters.html

0👍

Finally I just move the data from child to parent. Make the child pure and it works. Thanks for your help.

0👍

Can u try it like this way:

parent component:

<child @childReady="do()"></child>

export default {
    methods: {
        do() {
        }
    }    
}

child component:

mounted() {
    this.$emit('childReady');
}

Leave a comment