在页面上实现链接转化成二维码图片

<script type="text/javascript" src="js/jquery.qrcode.min.js">script>

导入jquery.qrcode.js,下载地址https://github.com/jeromeetienne/jquery-qrcode
用法:
jQuery(‘#imgId’).qrcode({
width:140,
height:140,
render:”canvas”, //设置渲染方式 table canvas
typeNumber : -1, //计算模式
correctLevel : 0,//纠错等级
background : “#ffffff”,//背景颜色
foreground : “#000000”,//前景颜色
text: data.result.jsapi_pay_url
});

出现错误:
jquery.js:6 Uncaught TypeError: jQuery(…).qrcode is not a function
把jquery.qrcode.js换成jquery.qrcode.min.js就可以了

你可能感兴趣的:(js)