1.安装qrcode
npm install --save qrcode
2.按需引入
import QRCode from 'qrcode'
3. 生成图片二维码 方法
QRCode.toDataURL('这里放需要生成的资源')
.then(url => {
this.imgPay = url //this.imgPay 就是二维码资源信息,直接使用就行<img :src="imgPay" alt="">
})
.catch(err => { //异常时的处理
console.error(err)
})