官方文档地址:https://github.com/SumiMakito/Awesome-qr.js/blob/master/README-zh_CN.md
文件下载地址:https://github.com/SumiMakito/Awesome-qr.js
代码片段:
//引入
<script type="text/javascript" src="./js/require.js"></script>
//html
<img id='qrcode' src="">
//js
var __awesome_qr_base_path = "js";
require([__awesome_qr_base_path + '/awesome-qr'], function(AwesomeQR) {
console.log(AwesomeQR)
var img = new Image();
img.crossOrigin = "Anonymous";
img.onload = () => {
AwesomeQR.create({
text: 'Makito loves Kafuu Chino.',
size: 200,
margin: 20,
backgroundImage: img,
bindElement: 'qrcode',
callback:function(){
console.log('success')
},
colorDark:'#222',
colorLight:'#abc',
});
};
img.src = "./timg.jpg";
文件结构
|- ...
|- index.html
|- js
|- awesome-qr.js
|- gif.js
|- gif.worker.js
|- require.js
|- ...
网友评论