Jquery.qrcode.min.js is a plug-in that generates two-dimensional code, with the premise that jquery is the first to be used, because Jquery.qrcode.min.js relies on jquery.
Basic usage
1. Introduction of JS
<script src= "Js/jquery-3.1.1.min.js" ></script> <script src= "Js/jquery.qrcode.min.js" ></ Script>
2. Building a container
<div class= "App" ></div>
3. Generate two-dimensional code
$ (". App"). QRCode ({ render: "Canvas", width:400, height:400, text: "http://www.cnblogs.com/ jiangcheng-langzi/" });
In this way, a two-dimensional code is generated, by sweeping the QR code, you can easily access this blog.
Expand the explanation
(1) QRCode There are two ways to generate QR codes: Table and Canvas.
Table mode: Will generate a lot of code, black and White is a TD, a total of 37 x-Square, the general choice is to be compatible with browsers that do not support canvas
Canvas mode: generated QR code actually using canvas drawing, can be saved as picture format
(2) QRCode default width height is 256px
(3) QRCode uses charCodeAt () for encoding conversion, and this method obtains its Unicode encoding by default, so if text contains Chinese, you need to use theencodeURI()转码。
(4) In addition, the foreground and background colors of the QR code can be specified by attributes foreground and background
Jquery.qrcode.min.js generate a QR code