npm install qrcodejs2;//安装包
<div id="qrcode"></div>//html
import QRCode from 'qrcodejs2'//引入方法
mounted() {//需要在mounted中调用QRCode方法
var qrcode = new QRCode(document.getElementById("qrcode"), {
width: 188,
height: 188,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.H
});
qrcode.makeCode("http://**.com/index.html");
}
源码地址 https://github.com/davidshimjs/qrcodejs