父組件:<parent :date_schedule="date_schedule"></parent>子組件:props: {
date_schedule:{ type:Array, default: []
},
},
data () { return {
...
}
},
watch: {
date_schedule: {
handler(newVal,oldVal) { console.log(newVal) console.log(oldVal) //console.log('date_schedule:update');
//this.update_calendar_schedule();
},
deep: true
},
table_data: {
handler(value) { //console.log('table_data:update');
//this.update_calendar_schedule();
},
deep: true
},
},
computed: {
table_data:{ get: function() { return this.date_schedule;
}, set: function(value) { console.log(value);
}
},
},子組件中使用table_data來渲染出一個table。當父組件的date_schedule修改時,子組件的date_schedule和table_data都有變化,但是子組件中的table視圖卻不隨變化而更新,顯示的永遠是還是上一次table_data數據。我知道是數據檢測變化的問題,但始終找不出是哪里的問題,請大家幫忙看一下~謝謝了
添加回答
舉報
0/150
提交
取消