效果图
WXML
WXSS
page{background-color: #efeff4;} .tui-preview-img{ width: 200rpx; height: 120rpx; }
JS
Page({ data: { previewImageArr:[] }, previewImage(e){ var self = this; wx.chooseImage({ count:8, success(res) { var tempFilePaths = res.tempFilePaths; self.setData({ previewImageArr: tempFilePaths}); } }) }, changePreview(e){ var self = this; wx.previewImage({ current: e.currentTarget.dataset.src, urls: self.data.previewImageArr }) } })
注意
wx.previewImage的参数current和urls必须是http链接。