How can vue send a value to the sub-component after requesting a callback through http?

The

sd array is passed to the subbuild. The value of the
sd array is obtained by the dynamic request interface. The
subbuild didn"t get the value at all. The this.sd in the
created method is also null.


maybe this will help you, walk you
or this, then you


beforeCreate this method is asynchronous, so the asynchronous operation on the other side of the created hook has not yet been assigned, so you can't get it in the created!
is it valuable to try for a delay of three seconds


listen for sd in subcomponents

// 
<template><component :sd="sd"></component></template>
// 
props:{sd: Array}  // 
watch:{
    sd: {
        immediate: true,  // sd
        handler(val, oldval){
            console.log(val)
        }
    }
}

whether the sd was empty during initialization, so the subcomponent reported an error. As a result, it cannot be rendered after a later re-assignment.

Menu