美文网首页
Awesome-qr.js 优雅的花式二维码生成器

Awesome-qr.js 优雅的花式二维码生成器

作者: 汀上 | 来源:发表于2019-05-13 15:27 被阅读0次

    官方文档地址: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
    |- ...

    相关文章

      网友评论

          本文标题:Awesome-qr.js 优雅的花式二维码生成器

          本文链接:https://www.haomeiwen.com/subject/pctraqtx.html