1
|
<template>
|
1
|
<template>
|
2
|
<!--尺码图片展示-->
|
2
|
<!--尺码图片展示-->
|
3
|
- <div v-if="sizeImage.imageUrl" class="size-img-container" :data-bid="brandId" :data-pid="productId">
|
|
|
4
|
- <img v-lazy="sizeImage.imageUrl" :style="{width: sizeImage.imageWidth, height: sizeImage.imageHeight}">
|
3
|
+ <div v-if="sizeImageList.length">
|
|
|
4
|
+ <div v-for="item in sizeImageList" :key="item.imageUrl" class="size-img-container" :data-bid="brandId" :data-pid="productId">
|
|
|
5
|
+ <img v-lazy="item.imageUrl" :style="{width: item.imageWidth, height: item.imageHeight}">
|
|
|
6
|
+ </div>
|
5
|
</div>
|
7
|
</div>
|
6
|
</template>
|
8
|
</template>
|
7
|
|
9
|
|
|
@@ -28,29 +30,28 @@ export default { |
|
@@ -28,29 +30,28 @@ export default { |
28
|
},
|
30
|
},
|
29
|
data() {
|
31
|
data() {
|
30
|
return {
|
32
|
return {
|
31
|
- sizeImage: {
|
|
|
32
|
- imageUrl: '',
|
|
|
33
|
- imageWidth: '100%',
|
|
|
34
|
- imageHeight: 'auto'
|
|
|
35
|
- }
|
33
|
+ sizeImageList: []
|
36
|
};
|
34
|
};
|
37
|
},
|
35
|
},
|
38
|
activated() {
|
36
|
activated() {
|
39
|
- this.getProductSizeImage({brand_id: this.brandId, product_id: this.productId}).then(result => {
|
|
|
40
|
- if (result.code === 200 && result.data && result.data.imageUrl) {
|
|
|
41
|
- let url = result.data.imageUrl.split('?')[0];
|
37
|
+ this.getProductSizeImages({brand_id: this.brandId, product_id: this.productId}).then(result => {
|
|
|
38
|
+ if (result.code === 200 && result.data) {
|
|
|
39
|
+
|
|
|
40
|
+ let listArr = [];
|
42
|
|
41
|
|
43
|
- // let imageWidth = result.data.imageWidth || 750;
|
42
|
+ result.data.forEach(function(item) {
|
44
|
|
43
|
|
45
|
- this.sizeImage.imageUrl = url + '?imageView2/2/w/750/q/60';
|
44
|
+ let url = item.imageUrl.split('?')[0];
|
|
|
45
|
+
|
|
|
46
|
+ listArr.push({imageUrl: url + '?imageView2/2/w/750/q/60', imageWidth: '100%', imageHeight: 'auto'});
|
|
|
47
|
+ });
|
46
|
|
48
|
|
47
|
- // this.sizeImage.imageWidth = imageWidth ? (imageWidth / 40) + 'rem' : '100%';
|
|
|
48
|
- // this.sizeImage.imageHeight = imageHeight ? (imageHeight / 40) + 'rem' : 'auto';
|
49
|
+ this.sizeImageList = listArr;
|
49
|
}
|
50
|
}
|
50
|
});
|
51
|
});
|
51
|
},
|
52
|
},
|
52
|
methods: {
|
53
|
methods: {
|
53
|
- ...mapActions(['getProductSizeImage'])
|
54
|
+ ...mapActions(['getProductSizeImages'])
|
54
|
}
|
55
|
}
|
55
|
};
|
56
|
};
|
56
|
</script>
|
57
|
</script>
|