The child component mounted cannot get the value of props
question:The data passed to the sub-assembly is called from the interface, resulting in the empty object or array being passed to the sub-component when creating the page.
Method 1
Use watch to listen to whether the median value of props has changed
Method 2 (Suggestions)
When calling subcomponents, add v-if to determine whether there is data in the array or object.
Component props cannot get the value for the first time
Add sync to the value
<el-dialog title="test" :="dialog" width="40%"> <room-Checked @event1="change($event)" :="date" /> </el-dialog>
Using v-if
<el-dialog title="test" :="dialog" width="40%"> <room-Checked @event1="change($event)" :="date" v-if=" > 0" /> </el-dialog>
Remember to define data= []
Use watch in child components
props:[ data ] watch: { date (newValue, oldValue) { if (newValue !== oldValue) { = [0].id ('date', ) } } },
The above is personal experience. I hope you can give you a reference and I hope you can support me more.