props: ['content', 'visible'], watch: { visible: { handler: function(val, oldval) { console.log('watch visible changed!') if(val){ this.initDefault(this.content)
}
}, deep: true, immediate: true
}, 'content.id': { handler: function(val, oldval) { console.log('watch content.id changed!') if(val !== oldval) { this.initDefault(this.content)
}
}, deep: true, immediate: true
},
},無論props怎么變化,兩個watch就是一句打印也沒有,同樣的代碼在別的頁面上用過,一點問題都沒有,換個地方用又不行了,vue這種破問題,一點排查的辦法都沒有,除了閉目養神去猜,或者砸電腦,還有其它路子么?
vue中子組件watch父組件傳過來的props,毫無反應,請問是怎么回事?
搖曳的薔薇
2018-07-18 13:01:30