How to click on the WeChat applet to view the original image

angryTom
Release: 2020-03-24 10:30:38
Original
6689 people have browsed it

How to click on the WeChat applet to view the original image

How to click to view the original image in the WeChat applet

First you need to prepare two image arrays, one to store the image URL of the preview image, and the other to store the image URL of the preview image. The image URL of the original image; then when you click on the preview image, pass the array of the original image into the wx.previewImage() method.

1. WXML code

     
Copy after login

2. JS code

data: { previewlist:['预览图链接','预览图链接','预览图链接'], originallist:['原图链接','原图链接','原图链接'] }, /** * 预览图片 */ previewImage: function (e) { var current = this.data.originallist[e.target.dataset.idx]; wx.previewImage({ current: current, // 当前显示图片的http链接 urls: this.data.originallist// 需要预览的图片http链接列表 }) } ,
Copy after login

Recommended learning:小program development

The above is the detailed content of How to click on the WeChat applet to view the original image. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!