生成 自定义徽标和标签 二维码 jQuery.qrcode

  • 源码大小:115.81KB
  • 所需积分:1积分
  • 源码编号:19JP-3293
  • 浏览次数:536次
  • 最后更新:2023年05月27日
  • 所属栏目:其他
我要下载
加入收藏
本站默认解压密码:19jp.com 或 19jp_com

简介

一个强大的、高度可定制的二维码生成器,可帮助您动态生成带有自定义图像(用于徽标)和标签(用于行动呼吁文本)的二维码。

更多功能:

  • 基于画布、图像或DIV的二维码。
  • 5个纠错级别。
  • 边界半径。
  • 自定义背景和填充颜色。

如何使用它:

1.创建一个将在其中生成二维码的容器。

  1. <div class="demo">
  2. </div>

2.在关闭body标记之前加载jQuery库和jQuery.qrcode插件。

  1. <script src="https://code.jquery.com/jquery-1.12.4.min.js"
  2. integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ"
  3. crossorigin="anonymous"></script>
  4. <script src="dist/jquery-qrcode.js"></script>

3.调用二维码容器上的函数并定义内容。

  1. $(".demo").qrcode({
  2. text: 'https://www.jqueryscript.net'
  3. });

4.在二维码上添加标签。

  1. $(".demo").qrcode({
  2.  
  3. // 0: normal
  4. // 1: label strip
  5. // 2: label box
  6. mode: 1,
  7. label: 'jQueryScript.Net',
  8. fontname: 'sans',
  9. fontcolor: '#000'
  10. });

5.在二维码中添加徽标图像。

  1. $(".demo").qrcode({
  2.  
  3. // 0: normal
  4. // 3: image strip
  5. // 4: image box
  6. mode: 3,
  7. image: "/path/to/logo.png"
  8.  
  9. });

6.更多具有默认值的配置选项。

  1. $(".demo").qrcode({
  2.  
  3. // 'canvas', 'image' or 'div'
  4. render: 'canvas',
  5.  
  6. // min/max versions
  7. minVersion: 1,
  8. maxVersion: 40,
  9.  
  10. // error correction level
  11. // 'L', 'M', 'Q' or 'H'
  12. ecLevel: 'L',
  13.  
  14. // offset in pixels
  15. left: 0,
  16. top: 0,
  17.  
  18. // size in pixels
  19. size: 200,
  20.  
  21. // code color or image element
  22. fill: '#000',
  23.  
  24. // background color or image element
  25. background: null,
  26.  
  27. // border radius
  28. radius: 0,
  29.  
  30. // quiet zone in modules
  31. quiet: 0,
  32.  
  33. // position options
  34. mSize: 0.1,
  35. mPosX: 0.5,
  36. mPosY: 0.5
  37.  
  38. });

更新日志:

2022-11-21

  • 版本0.18.0

预览截图