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
})
this.createPicture()
},