当前位置: 代码迷 >> 综合 >> vue移动端开发生成二维码(qrcodejs2)
  详细解决方案

vue移动端开发生成二维码(qrcodejs2)

热度:49   发布时间:2023-11-29 10:35:17.0

1 引包

npm install qrcodejs2 --save

2 使用

import QRCode from 'qrcodejs2'

html

     <div ref="qrCodeDiv" ></div>

方法

bindQRCode () {let t = this// console.log(t.userInfo.account)new QRCode(this.$refs.qrCodeDiv, {text: 'http://xxxxxx.cn/#/SignAgency?code=' + t.userInfo.account,// text: 'http://192.168.0.193:8765/#/SignAgency?code=' + t.userInfo.account,width: 200,height: 200,colorDark: '#333333', // 二维码颜色colorLight: '#ffffff', // 二维码背景色correctLevel: QRCode.CorrectLevel.L// 容错率,L/M/H})
},

在这里插入图片描述


Tips:【小程序云开发】中高级前端面试题库(源码:小程序中联系我哟)。
---------- 创作不易,感谢大家,请多多支持!
在这里插入图片描述