banner.js
787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import wx from '../../../utils/wx';
import formatImage from '../../../utils/formatImage';
Component({
properties: {
imageList: {
type: Array,
value: []
},
productName: {
type: String,
value: ''
}
},
data: {
indicatorDots: false,
interval: 5000,
autoplay: false,
duration: 500,
circular: true,
swiperCurrent: 0
},
methods: {
swiperChange: function(e) {
this.setData({
swiperCurrent: e.detail.current
});
},
previewImage: function(e) {
const src = e.currentTarget.dataset.src;
let imgList = this.properties.imageList.map(item => formatImage.image(item.image_url, 750, 1000));
wx.previewImage({
current: src,
urls: imgList
});
},
}
});