用uni.previewImage({}) 来直接做图片的预览和识别二维码

需求:
客户要求用户不用截图保存,通过直接用手机识别二维码关注,所以,这就需要我们进行图片的预览即可以解决。

<image src="https://lr-huayoushi.oss-cn-beijing.aliyuncs.com/image/2021-11-26/a6309282ce18e50eb0f8e725763d28b8.jpg" mode=""  @click="previewImage" ></image>

method:{

```c
previewImage(e){
	uni.previewImage({
		urls: ["https://lr-huayoushi.oss-cn-beijing.aliyuncs.com/image/2021-11-26/a6309282ce18e50eb0f8e725763d28b8.jpg"], //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
		current: 'https://lr-huayoushi.oss-cn-beijing.aliyuncs.com/image/2021-11-26/a6309282ce18e50eb0f8e725763d28b8.jpg', // 当前显示图片的http链接,默认是第一个
		success: function(res) {
			console.log(res)
	},
		fail: function(res) {},
		complete: function(res) {
			console.log(res)
	},
})
}

效果图:
在这里插入图片描述

1.如果打开 一个图片列表,可以这样来使用

data(){
	return{
		imageList:[
			''
			]
	}
}
preview(){
	let _this=this;
	
	//这里直接把图片列表的数组放入即可
	uni.previewImage({
			current:'',
			urls:_this.imageList,
			indicator:'default',
			loop:true,
			success:function(res){
				console.log(res)
		}
	})
},
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值