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