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:【小程序云开发】中高级前端面试题库(源码:小程序中联系我哟)。
---------- 创作不易,感谢大家,请多多支持!