父组件调用
<monthLine :updateTime="updateTime"></monthLine>
子组件接收
props:['updateTime'],
watch:{
updateTime:{
handler(newValue, oldValue) {
this.init() //父组件updateTime对象改变会触发此函数
},
deep: true
}
},
<monthLine :updateTime="updateTime"></monthLine>
props:['updateTime'],
watch:{
updateTime:{
handler(newValue, oldValue) {
this.init() //父组件updateTime对象改变会触发此函数
},
deep: true
}
},
本文标题:vue子组件监听父组件传值,动态更新数据
本文链接:https://www.haomeiwen.com/subject/erhlbktx.html
网友评论