uniapp點選預覽單張或多張圖片
阿新 • • 發佈:2021-01-23
技術標籤:uniApp
uniapp點選預覽單張或多張圖片
//點選預覽圖片(單張)
previewImg(previewImg){
let _this = this;
let imgsArray = [];
//根據api拼接
imgsArray[0] = 'http://47.114.50.248/fc/'+previewImg.ftpUrl+previewImg.ftpName
uni.previewImage({
current: 0,
urls: imgsArray
});
},
//預覽多張圖片
previewImg (previewImg,index) {
let _this = this;
let imgsArray = [];
console.log('previewImg',previewImg);//當前
for (let i = 0; i < _this.imageslist.length; i++) {
//根據api拼接
let imageslisturl = 'http://47.114.50.248/fc/'+_this.imageslist[i].ftpUrl+_this.imageslist[i].ftpName
if(imageslisturl !== ""){
imgsArray.push(imageslisturl)
}
}
uni.previewImage({
current: index - 1,
urls: imgsArray,
indicator: 'number',
loop: true
});
}