亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

子組件computed屬性改變視圖不改變

子組件computed屬性改變視圖不改變

哆啦的時光機 2019-03-19 19:36:07
父組件:<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數據。我知道是數據檢測變化的問題,但始終找不出是哪里的問題,請大家幫忙看一下~謝謝了
查看完整描述

2 回答

?
泛舟湖上清波郎朗

TA貢獻1818條經驗 獲得超3個贊

可以試試改變table_data的引用,重新賦值一個對象給它,這或許會觸發computed的重新計算

查看完整回答
反對 回復 2019-03-19
  • 2 回答
  • 0 關注
  • 1290 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號