Home  >  Article  >  How to generate QR code with mini program

How to generate QR code with mini program

藏色散人
藏色散人Original
2020-03-18 09:08:3315724browse

How to generate QR code with mini program

How does the mini program generate a QR code?

First open the development tools and create a new small program code snippet, as shown in the figure below

How to generate QR code with mini program

##Then open github, search for weapp-qrcode, and select The first option, as shown in the picture below

How to generate QR code with mini program

Then enter the details interface and download the weapp.qrcode.min.js file, as shown in the picture below

How to generate QR code with mini program

Then copy the weapp.qrcode.min.js file to the mini program directory, as shown in the figure below

How to generate QR code with mini program

Then open the mini program index.js file, import the weapp.qrcode.min.js file at the top, as shown below

How to generate QR code with mini program

Then open the wxml file, declare a canvas, and set a canvas- id, as shown in the figure below

How to generate QR code with mini program

Then call the qrcode method in the index.js file to generate the QR code. The text attribute refers to the content of the QR code, as shown in the figure below

How to generate QR code with mini program

Finally run the applet and you can see the generated QR code. Scan and read the text content, as shown in the figure below

How to generate QR code with mini program

The above is the detailed content of How to generate QR code with mini program. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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