根据URL地址生成二维码

下载qrcodejs URL:http://davidshimjs.github.io/qrcodejs/

在页面中引用jq和qrcodejs

var qrcode = new QRCode("qrcode", {  
	    text: data.shortURL,   //URL地址
		width: 260,
		height: 260,
		colorDark: '#000',    //二维码颜色
		colorLight: "#ffffff"  //背景颜色
});

"qrcode" 为一个标签的id,执行后会在标签中插入一个cansave和img标签

img的src为 base64值

 

vue 中使用

安装  npm install qrcodejs2 --save

页面中引用  import QRCode  from "qrcodejs2"

你可能感兴趣的:(H5)