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对象

饮歌长啸
繁华开满天机
缥缈止盈
随时随地看视频慕课网APP