关注前端开发
关注用户体验

分享一个生成二维码的插件–QRCode.js

随着移动设备的普及,日常生活中随处可见二维码,大有一码走天下之势。那么前端如何来生成二维码?

通过QRCode.js我们可以快速生成二维码啦,一起来看看怎么使用吧。

1、引入插件

    /*html*/
    <div id="qrcode"></div>

    /*js*/
    <script src="qrcode.js"></script>

2、基本用法

    var qrcode = document.getElementById('qrcode')

    /*直接生成二维码*/
    new QRCode(qrcode, 'http://www.daqianduan.com')

    /*也可以配置二维码的宽高等*/
    var qrcodeObj = new QRCode('qrcode', {
        text: 'http://www.daqianduan.com',
        width: 256,
        height: 256,
        colorDark : '#000000', //前景色
        colorLight : '#ffffff'  //背景色
    })

3、API

  • 设置二维码内容–makeCode
    qrcodeObj.makeCode('http://www.daqianduan.com/?p=6518&preview=true')
  •  清除二维码–clear
    qrcodeObj.clear()

 

 

 

赞(209)
未经允许不得转载:大前端 » 分享一个生成二维码的插件–QRCode.js
分享到: 更多 (0)

评论 23

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #23

    1

    11天前回复
  2. #22

    Hey there, You’ve done a fantastic job. I will definitely digg it
    and personally recommend to my friends. I’m sure they will be benefited from this website.

  3. #21

    aa内容回测zzzzzzaAAAAAA

    Cassandra Toombs1个月前 (05-20)回复
  4. #20

    Can I simply say that of a relief to seek out somebody who truly knows what theyre speaking about over the internet. You actually know how to bring a concern to light and earn it important. The diet ought to ought to see this and fully grasp this side in the story. I cant think youre less popular because you undoubtedly possess the gift.

    Nonton Anime1个月前 (05-10)回复
  5. #19

    I got what you intend,bookmarked , very decent site.

    cat blog1个月前 (05-09)回复
  6. #18

    Excellent blog you have got here.. It’s hard to find high-quality writing like yours nowadays. I really appreciate people like you! Take care!!

    DMC52个月前 (05-01)回复
  7. #17

    Great blog you have got here.. It’s hard to find quality writing like yours these days. I seriously appreciate individuals like you! Take care!!

    Apex Legends Octane2个月前 (04-21)回复
  8. #16

    Excellent blog you’ve got here.. It’s difficult to find high-quality writing like yours these days. I seriously appreciate people like you! Take care!!

    Apex Legends Season 12个月前 (04-20)回复
  9. #15

    I truly wanted to write a brief note so as to say thanks to you for the stunning secrets you are sharing here. My extensive internet investigation has at the end of the day been paid with pleasant suggestions to share with my friends and family. I would repeat that we readers actually are unequivocally blessed to live in a very good network with many brilliant individuals with very helpful techniques. I feel somewhat grateful to have encountered your entire webpages and look forward to some more pleasurable minutes reading here. Thank you once more for everything.

    huidspecialist2个月前 (04-19)回复
  10. #14

    Looks realy great! Thanks for the post.

    Huidverjonging2个月前 (04-19)回复
  11. #13

    I truly wanted to write a brief note so as to say thanks to you for the stunning secrets you are sharing here. My extensive internet investigation has at the end of the day been paid with pleasant suggestions to share with my friends and family. I would repeat that we readers actually are unequivocally blessed to live in a very good network with many brilliant individuals with very helpful techniques. I feel somewhat grateful to have encountered your entire webpages and look forward to some more pleasurable minutes reading here. Thank you once more for everything.

    Rocasea2个月前 (04-18)回复
  12. #12

    Looks realy great! Thanks for the post.

    Huidspecialisaties2个月前 (04-18)回复
  13. #11

    Enjoyed the post.

    huidspecialist2个月前 (04-17)回复
  14. #10

    Looks realy great! Thanks for the post.

    Pigmentatie2个月前 (04-16)回复
  15. #9

    After looking at a number of the blog articles on your site, I truly like your way of blogging. I added it to my bookmark website list and will be checking back in the near future. Please check out my website as well and tell me what you think.

    Apex Legends2个月前 (04-12)回复
  16. #8

    I simply had to say thanks yet again. I do not know the things I would have made to happen in the absence of those ways contributed by you relating to such a theme. It previously was a real terrifying circumstance in my circumstances, but noticing your specialized fashion you processed the issue forced me to jump with gladness. I’m happy for your information and then believe you comprehend what a powerful job that you’re getting into educating some other people through the use of a web site. I know that you have never come across any of us.

    mkb2个月前 (04-11)回复
  17. #7

    I simply had to say thanks yet again. I do not know the things I would have made to happen in the absence of those ways contributed by you relating to such a theme. It previously was a real terrifying circumstance in my circumstances, but noticing your specialized fashion you processed the issue forced me to jump with gladness. I’m happy for your information and then believe you comprehend what a powerful job that you’re getting into educating some other people through the use of a web site. I know that you have never come across any of us.

    boekhouder zzp breda2个月前 (04-11)回复
  18. #6

    Everyone loves it when folks come together and share thoughts. Great website, stick with it!

    Apex Legends3个月前 (03-31)回复
  19. #5

    I think other site proprietors should take this web site as an model – very clean and wonderful style and design, in addition to the content. You’re an expert in this area!

    my singing monsters3个月前 (03-28)回复
  20. #4

    Your house is valueble for me. Thanks!? This web page can be a walk-via for the entire information you needed about this and didn know who to ask. Glimpse here, and also you l definitely discover it.

    Mitchel Darwish3个月前 (03-11)回复
  21. #3

    很实用,但是在哪里下载呢?

    谈无神论的龙8个月前 (10-15)回复
  22. #2

    挺好的

    haha10个月前 (08-31)回复
  23. #1

    mark

    solfKwolf11个月前 (07-25)回复

themebetter 国内更好的WordPress主题服务商

立即前往