uniapp实现图片(单张/多张)预览
一、单张预览
getImgIndex(index) {
let imgs = this.temperatureData.map(item => {
return item.img
})
uni.previewImage({
urls: imgs,
current: index
})
},
二、多张预览
getImgIndex(index) {
this.imgArray = [];
this.imgArray = this.temperatureData[index].img
uni.previewImage({
current: 0, //当前为第几张
urls: this.imgArray,
indicator: 'number',
loop: true
});
},
效果图:
预览
We’re not put on this Earth to think of only ourselves