1.下载
npm install qrcode --save-dev
2.引入
import QRCode from “qrcode”;
QRCode.toDataURL(
url,//http:www.XXXXXX
{
errorCorrectionLevel: "H",//容错级别
type: 'image/jpeg',//生成的二维码类型
quality: 0.3, //二维码质量
margin: 0, //二维码留白边距
width: 280, //宽
height: 280, //高
color: {
dark: "#333",//前景色
light: "#fff",//背景色
},
},
(err, url) => {
console.log(err,url);
}
);