博客
关于我
在vue项目中使用qrcodesjs2生成二维码
阅读量:336 次
发布时间:2019-03-04

本文共 697 字,大约阅读时间需要 2 分钟。

最近写项目遇到一个需求需要生成二维码,看了一下项目中生成二维码使用的都是qrcodesjs2,而且操作比较简单。在这里简单记录一下

安装

npm i qrcodejs2 -S

html

项目中需要打印多个二维码,而且这样更加通用无论打印单个还是多个都可以

js

// 生成二维码   printTwoCode(width) {          for (let j in this.qrcode) {              let code = this.qrcode[j]; // 二维码内容           new QRCode(this.$refs[`${     this.qrcode[j]}`][0], {                  text: code,               render: 'canvas',               width: width,               height: width,               colorDark: '#000000',               colorLight: '#ffffff'           });       }   },

清除

for (let j in this.qrcode) {          this.$refs.qrcode[j][0].innerHTML = ''  }

使用

this.$nextTick(() => {        this.printTwoCode(130); });

转载地址:http://megh.baihongyu.com/

你可能感兴趣的文章
Network Dissection:Quantifying Interpretability of Deep Visual Representations(深层视觉表征的量化解释)
查看>>
Network Sniffer and Connection Analyzer
查看>>
Network 灰鸽宝典【目录】
查看>>
Networkx写入Shape文件
查看>>
NetworkX系列教程(11)-graph和其他数据格式转换
查看>>
Networkx读取军械调查-ITN综合传输网络?/读取GML文件
查看>>
network小学习
查看>>
Netwox网络工具使用详解
查看>>
Net与Flex入门
查看>>
net包之IPConn
查看>>
net发布的dll方法和类显示注释信息(字段说明信息)[图解]
查看>>
Net操作Excel(终极方法NPOI)
查看>>
Net操作配置文件(Web.config|App.config)通用类
查看>>
Net连接mysql的公共Helper类MySqlHelper.cs带MySql.Data.dll下载
查看>>
NeurIPS(神经信息处理系统大会)-ChatGPT4o作答
查看>>
neuroph轻量级神经网络框架
查看>>
Neutron系列 : Neutron OVS OpenFlow 流表 和 L2 Population(7)
查看>>
NEW DATE()之参数传递
查看>>
New Relic——手机应用app开发达人的福利立即就到啦!
查看>>
new 一个button 然后dispose,最后这个button是null吗???
查看>>