uniapp单/多图片预览

<image @tap="lookImg(hxInfo.ico_thumb_url)" style="width: 100%;height: 100%;" :src="hxInfo.ico_thumb_url" mode=""></image>

<swiper-item @tap="lookesImg(index)" v-for="(item, index) in picinfo" :key="index">
			<image style="width: 100%;" :src="item.ico_thumb_url.replace(/\\/g,'/')" mode="aspectFill" />
</swiper-item>

预览事件绑定:

// 单张图片
			lookImg(image) {
				var imgArr = [];
				imgArr.push(image)
				uni.previewImage({
					urls: imgArr,
					current: imgArr[0]
				});
			},
			// 多张图片
			lookesImg(index) {
				// picinfo:图片对象
				let photoList = this.picinfo.map(item => {
					return item.path_url;
				});
				uni.previewImage({
					current: index,
					urls: photoList
				});
			},

你可能感兴趣的:(uniapp,javascript)