computed: {
comp: function () {
return () => import(`./component/item${this.formItem.item_type}.form`);
}
},當我切換this.formItem.item_type的值,comp沒有被觸發computed: {
comp: function () {
console.log(this.formItem.item_type)
return () => import(`./component/item${this.formItem.item_type}.form`);
}
},當我加上console.log(this.formItem.item_type)時,正常觸發,注釋掉又不能正常觸發,這是為什么呢?另外:我使用watch去監聽 正常了watch:{
'formItem.item_type': function (val, oldVal) {
this.comp = () => import(`./component/item${this.formItem.item_type}.form`);
}
},補充this.formItem對象
vue computed 計算屬性當依賴屬性更新時計算屬性沒有執行?
飲歌長嘯
2018-07-06 13:13:48