QR.js JS 生成 PNG二维码图片,使用说明

github 上的原文什么都没有提,我给 fork 了一个,并添加了使用说明
https://github.com/KyleBing/qr.js

一、使用说明

1. Browser 模式

html 中引入 qr.js

<script src="qr.js"></script>

生成 png 图片

let linkAddress = 'https://kylebing.cn'
let qrCodeData = QRCode.generatePNG(linkAddress)
document.querySelector('.qr-code').setAttribute('src', qrCodeData)

2. Vue 模式

Vue

<img :src="shareQrCode" alt="qr">
let linkAddress = 'https://kylebing.cn'
this.shareQrCode = QRCode.generatePNG(linkAddress)

二、 option 说明

参数 可选 参数类型 可能的值 说明
version 可选 Number -1, 1 ~ 40 版本,当为 -1 时,使用可能的最小值
mode 可选 String numeric, alphanumeric, octet 默认使用最小的值
ecclevel 可选 String L M Q H 默认值 L

generateHTML generatePNG

参数 可选 参数类型 可能的值 说明
modulesize 可选 Number Number 每个方块的大小,默认为 5px
margin 可选 Number Number 边框距离,默认为 4px

原文说明

// the public interface is trivial; the options available are as follows:
//
// - version: an integer in [1,40]. when omitted (or -1) the smallest possible
//   version is chosen.
// - mode: one of 'numeric', 'alphanumeric', 'octet'. when omitted the smallest
//   possible mode is chosen.
// - ecclevel: one of 'L', 'M', 'Q', 'H'. defaults to 'L'.
// - mask: an integer in [0,7]. when omitted (or -1) the best mask is chosen.
//
// for generate{HTML,PNG}:
//
// - modulesize: a number. this is a size of each modules in pixels, and
//   defaults to 5px.
// - margin: a number. this is a size of margin in *modules*, and defaults to
//   4 (white modules). the specficiation mandates the margin no less than 4
//   modules, so it is better not to alter this value unless you know what
//   you're doing.

以下是原仓库 Readme:

qr.js: QR code generator in pure Javascript (2011)

This is a fairly standalone script for producing QR code on the fly.
Originally developed for my own interest, the code is fully commented and well-structured.
The code is in the public domain (or to be exact, Creative Commons Zero),
and you can use it for absolutely any purpose.

See also a node.js module based on qr.js, packaged by Nadav Ivgi.

QR.js JS 生成 PNG二维码图片,使用说明相关推荐

  1. 【彩色二维码】处理生成彩色二维码图片

    调用草料二维码的API接口 https://cli.im/api/qrcode/code?text=***&mhid=*** mhid:草料二维码的模版样式id,这里选择的是[vUbEWVm7 ...

  2. 【vue】链接生成为二维码图片-qrcode.js2

    通过qrcode.js2将链接生成为二维码图片 npm下载包 npm i qrcode.js2 Demo <template><div ref='qrcode'></di ...

  3. 在线生成简单二维码图片

    在线生成简单二维码图片: http://www.swetake.com/qrcode/sample_e.html 草料二维码生成器:http://cli.im/

  4. uni-app/js/小程序/生成支付二维码图片,类似于支付宝和微信商家码

    业务需求 一个电子商务公司需要一个支付功能,该支付功能通过微信扫码或者支付宝扫码实现的,并且该二维码商户可以下载下来,类似于微信商家码.如下图,鉴于公司相关的保密协议,我马赛克了头部和中间的商标相关说 ...

  5. 链接生成动态二维码图片显示在页面上

    //引入jar包  core-3.3.0.jar  地址 http://jareye.com/jar/list.html?q=BarcodeFormat // js绑定二维码到页面 var url=& ...

  6. 微信支付 生成付款二维码链接 并生成支付二维码图片 .net C#

    //生成付款二维码链接                 string pay_url = PayURL(order_id_parent.ToString(), _total_fee.ToString( ...

  7. (简单详细)uniapp实现自定义海报内容并生成海报二维码图片(可拖拽,可调节大小)

    实现效果 应用场景 公司遇到一个需要实现自定义海报才可以满足客户需求的问题,实现自定义海报内容,同时上传的二维码可以自动调节,需要用到canvans的知识,如果没有,那么可以直接使用我的这个案例即可 ...

  8. JS qrcode生成的二维码无法扫描

    这个问题只出现在极速模式,可能是由于限制了二维码宽高度,尝试解放下在扫描试试,限制了,可能让二维码的像素信息变小无法扫描

  9. javascript动态生成网址二维码图片

    这个实现二维码生成功能的是引用谷歌google的JS来实现的,可以兼容几乎所有浏览器,包括动态和静态网页,具有加载速度快的特点! 代码如下: 放到你想添加二维码的位置 ; <script typ ...

最新文章

  1. 全国计算机二级vfp知识点,全国计算机二级VFP知识点总结
  2. java中的equals()空对象的出错
  3. Android中用GridView实现九宫格的两种方法(转)
  4. 领域应用 | 用知识图谱玩唐诗,“唐诗别苑”附庸端午节的别样风雅!
  5. 存储过程 insert
  6. 2019蓝桥杯C++B:等差数列(详解)
  7. Altium Designer 原理图输出为PDF文件
  8. win7忘记密码不用工具进入
  9. python3中26个英文字母排序_26个英文字母的排序是怎样排的?
  10. 一张图说明白数据安全管理体系的规划
  11. Codeforces Round #521 (Div. 3) E. Thematic Contests
  12. 求不规则图形外接圆的算法 (附:三角形外接圆计算公式)
  13. ansys经典界面分析工字钢_ansys工字钢实例分析.doc
  14. Linux学习06---shell基础
  15. 安卓浮动分组手机联系人快速定位demo
  16. 做模具设计的,为什么那么多人要用UG
  17. 网站性能评测工具YSlow的使用
  18. 360u盘小助手绿色版
  19. 【2022吴恩达机器学习】决策树
  20. java 美团 订单推送,记一次美团外卖推送报文丢失

热门文章

  1. 终于等到你!2020年最新中科院期刊分区表正式公布!
  2. 机器视觉系统在汽车发动机装配线上的应用
  3. 用小觅双目相机跑ORB-SLAM2
  4. 【教程】介绍、安装、配置和完全卸载2019VDP虚拟现实设计平台
  5. 使用mongoDB中的问题
  6. Perforce现代软件工程与古代哲学:儒家思想
  7. 配置GOPROXY安装VScode的go语言开发插件
  8. 部分银行核心系统的资料 【转】
  9. Built-in转URP Chapter10(3)-Fresnel 菲涅尔效果
  10. 单精度浮点数 float、双精度浮点数 double