vue子组件监听父组件传值,动态更新数据

2020-11-09  本文已影响0人  吃肉肉不吃肉肉

父组件调用

 <monthLine :updateTime="updateTime"></monthLine>

子组件接收

props:['updateTime'],
  watch:{
    updateTime:{
      handler(newValue, oldValue) {
            this.init()            //父组件updateTime对象改变会触发此函数
    },
    deep: true
    }
  },
上一篇 下一篇

猜你喜欢

热点阅读