一个好用的库
http://diamont1001.github.io/jrQrcode/
1.安装
npm install jr-qrcode
2.vue使用的页面中引入
import jrQrcode from "jr-qrcode"
3.使用
generateQR(){
let obj = 'https://www.baidu.com'; //需要生成的内容
var imgBase64 = jrQrcode.getQrBase64(obj); //生成二维码
this.img = imgBase64
console.log(this.img)
}
4.生成结果