滑过一个图片获取该图片的id,或者打印其他的item值
只需要加:item-id="{{item.id}}"
<swiper bindchange="swiperchange">
<block wx:for="{{photos}}" wx:key='{{item.id}}'>
<swiper-item item-id="{{item.id}}">
<image src='{{item.url}}' mode="widthFix" class="slide-image"></image>
</swiper-item>
</block>
</swiper>
js:
swiperchange: function(e) {
console.log(e)
console.log(e.detail.currentItemId)
},
打印console.log(e)中显示: