watch
watch:{
totalNum: { //totalNum是需要监听的数据
handler(newVal, oldVal){
console.log(newVal, oldVal)
},
immediate: true // 组件初始化时,立刻监听totalNum
},
}
父组件传值cityPickerdata到子组件,加sync属性(作用是允许反向修改数据!!!)
<cityPicker :cityPickerdata.sync="form.cityPickerdata" ></cityPicker>
监听多个数据,emit更新