banner.js 787 Bytes
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
      });
    },
  }
});