Article From:https://segmentfault.com/q/1010000012151940
Question:
The prop I received in the subcomponent is
props:{
data1:{
type:Array,
default:[],
}
}
Why is mounted printing in sub components empty? The length is 0
Answer 0:
The code is too little to judge.
First, confirm the parent componentdata1
Is there any value
Second, subcomponentsprops
The default value of array / object should be returned by a factory function, such as:
props:{
data1:{
type:Array,
default: function() {
return []
}
}
}
Link of this Article: Vue one-way data stream