uni-app 圖片點選放大預覽圖片 單張 多張
阿新 • • 發佈:2021-01-19
//單張圖片
previewImg(logourl) {
let _this = this;
let imgsArray = [];
imgsArray[0] = logourl
uni.previewImage({
current: 0,
urls: imgsArray
});
},
// 預覽圖片多張
//this.imgUrlList圖片陣列
previewImg(index) {
let _this = this;
let imgsArray = [];
for (let i = 0; i < this.imgUrlList.length; i++) {
if (this.imgUrlList[i].videoUrl == "") {
imgsArray.push(this.imgUrlList[i].imgUrl);
}
}
// #ifdef MP
uni.previewImage({
current: index - 1,
urls: imgsArray,
indicator: 'number',
loop: true
});
// #endif
// #ifndef MP
uni.previewImage({
current: index - 1,
urls: imgsArray,
indicator: 'number',
loop: true
});
// #endif
},