data() {
return {
counter: 0,
imagesLength: 0
}
},
methods: {
imgLoad() {
// this.counter += 1;
if (++this.counter === this.imagesLength) {
this.$emit('imageLoad')
}
}
},
watch: {
detailInfo() {
this.imagesLength = this.detailInfo.detailImage[0].list.length
}
}
watch监听,会拿到最后数据
利用了counter每次加一,直到图片加载完成,全等于数据图片长度,才发射出去