jquery-qrcode
1.1、jquery-qrcode简介
是什么 ?:jQuery plugin for a pure browser qrcode generation. It allow you to easily add qrcode to your webpages. It is standalone, less than 4k after minify+gzip, no image download. It doesnt rely on external services which go on and off, or add latency while loading. It is based on a library which build qrcode in various language. jquery.qrcode.js wraps it to make it easy to include in your own code.
开发语言:JavaScript
源码仓库:https://github.com/jeromeetienne/jquery-qrcode
1.2、通过开源CDN引入jquery-qrcode

jsDelivr    

<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.0/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery-qrcode@1.0.0/jquery.qrcode.min.js"></script>

BootCDN    

<script src="https://cdn.bootcss.com/jquery/3.5.0/jquery.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
1.3、通过下载到本地引入jquery-qrcode

step1、通过包管理器安装jquery-qrcode

包管理器安装命令
bowerbower install jquery-qrcode --save
npmnpm install jquery-qrcode --save
yarnyarn add jquery-qrcode

step2、在HTML代码中引入JavaScript

<script src="/bower_components/jquery/jquery.min.js"></script>
<script src="/bower_components/jquery-qrcode/jquery.qrcode.min.js"></script>
1.4、jquery-qrcode使用示例

step1、创建一个div,用于绘制二维码

<div id="qrcode"></div>

step2、调用qrcode()

$('#qrcode').qrcode("http://blog.fpliu.com/it");

或者:

$('#qrcode').qrcode({width: 64, height: 64, text: "http://blog.fpliu.com/it"});