浅谈VUE,使用watch方法监听父组件传到子组件的数据。

 props:['updateData'],
  data(){
    return{
     form: {
          _name:'',
      },
    }
  },

第一步接收数据:

props:['updateData']
 
第二步动态改变值:
mounted(){
    this.form._name = this.updateData._name;
},

第三步使用watch监听 updateData数据

 watch:{
    updateData: function (newVal ,oldVal){ //不能用箭头函数
        this.form._name = newVal._name
    }
  }
 
原文地址:https://www.cnblogs.com/yetiezhu/p/12602344.html