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

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

在这里插入图片描述

发布了70 篇原创文章 · 获赞 67 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/qq_37896578/article/details/100853906