因为layui已经有内置的jquery了,直接使用内置的jquery。
layui.define(["jquery"], function (exports) {
var jQuery = layui.jquery;
/**中间是jquery.qrcode.js的代码**/
for (function(a) {
a.fn.qrcode = function(b) {}}(jQuery),
.
.
.
,i = 0; 8 > i; i++) {
QRMath.EXP_TABLE[i] = 1 << i
}
exports('qrcode', jQuery.fn.qrcode);
});
使用:
$("#qrcodeContainer").qrcode({
render : "canvas", //设置渲染方式,有table和canvas
text : qrcode_text, //扫描二维码后自动跳向该链接
width : "120", //二维码的宽度
height : "120", //二维码的高度
imgHeight:'40',
imgWidth:'40',
background : "#ffffff", //二维码的后景色
foreground : "#000000", //二维码的前景色
src:'logo-qrcode.png', //二维码中间的图片
});