报错:
相关代码
watch: {
detailInfo() {
this.imagesLength = this.detailInfo.detailImages[0].list.length;
},
}
分析:watch中detailInfo无数据传入
解决:添加个判断条件,无error
watch: {
detailInfo() {
// this.imagesLength = this.detailInfo.detailImages[0].list.length;
this.imagesLength =
this.detailInfo.length > 0
? this.detailInfo.detailImages[0].list.length
: 0;
},
},