Communication problems between vue parent and child components

the parent component requests data from the background in the created phase
clipboard.png



clipboard.png
you can see that the parent component has not yet requested completion when the child component receives it. How to solve the problem of writing in that lifecycle

Mar.28,2021

reason: this is because nudata is worth passing is an asynchronous process, and the rendering of sub-components will of course be solved by undefined
before the data is obtained: in < nutrient: nudata= "nutrientInfo" VMI if = "isDataReady" > < / nutrient > isDataReady is set to true after data acquisition

extension:
Vue life cycle deep
Vue component communication
Vue component communication deep Vuex


use computed in the parent component
use the method ide/computed.html" rel=" nofollow noreferrer "> https://cn.vuejs.org/v2/guide.

  computed: {
   
    },

declare all the data needed by your parent and child components in data, so that even if the original value is null, it will not be wrong


declare all the data needed by your parent and child components in data, so that even if the original value is null, it will not be wrong.
then computed the parameters passed by the parent component in the child component.


computed:{
    Na (){return this.nudata[3]}
}

created () {
    this.$nextTick(()=>{
        console.log(this.nudata)
    }) 
},

parent component pass value plus v-if judgment condition, the equivalent exists and then passes through


Set the key value in

data, otherwise vue will not supervise your variables

data () {
    return {
        nutrientInfo: []
    };
}
Menu