是什么 ? | : | a 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 |
<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>
<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>
step1、通过包管理器
安装jquery-qrcode
包管理器 | 安装命令 |
---|---|
bower | bower install jquery-qrcode --save |
npm | npm install jquery-qrcode --save |
yarn | yarn 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>
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"});