< swiper style = 'width:100%;height:300rpx;' > < block wx:for = "{{swiper_imgUrls}}" wx:key = "item" > < swiper-item > < image catchtap = "showOneImg" data-url = "{{img_domain}}{{item}}" src = "{{img_domain}}{{item}}" mode = "widthFix" data-image = "{{img_domain}}{{item}}" /> </ swiper-item > </ block > </ swiper > |
js部分
Page({ data: { swiper_imgUrls: [ 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1529480609&di=a611f83419bf58d50dc0d2f279f1bfd7&imgtype=jpg&er=1&src=http%3A%2F%2Fimgsrc.baidu.com%2Fimgad%2Fpic%2Fitem%2F377adab44aed2e738e79b3028c01a18b87d6fa0f.jpg' , 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=225610514,2367156637&fm=27&gp=0.jpg' ] }, //事件处理函数 onLoad: function () { }, showOneImg: function (e) { console.log(e) wx.previewImage({ current: e.target.dataset.url, // 当前显示图片的http链接 urls: this .data.swiper_imgUrls // 需要预览的图片http链接列表 }) } }) |
你好,安卓机现在是没有显示这个图片下标的。之后可能会改进对其ios和安卓。