新会员白菜网送体验金前端开发
新会员白菜网送体验金用户体验

分享一个生成二维码的插件–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('?p=6518&preview=true')
  •  清除二维码–clear
    qrcodeObj.clear()

 

 

 

注册就送10元(207)
未经允许不得转载:大前端 » 分享一个生成二维码的插件–QRCode.js
分享到: 更多 (0)

评论 17

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #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!!

  2. #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!!

  3. #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.

  4. #14

    Looks realy great! Thanks for the post.

  5. #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.

  6. #12

    Looks realy great! Thanks for the post.

  7. #11

    Enjoyed the post.

    huidspecialist1周前 (04-17)回复
  8. #10

    Looks realy great! Thanks for the post.

    Pigmentatie1周前 (04-16)回复
  9. #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)回复
  10. #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)回复
  11. #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.

  12. #6

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

    Apex Legends3周前 (03-31)回复
  13. #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!

  14. #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 Darwish1个月前 (03-11)回复
  15. #3

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

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

    挺好的

    haha8个月前 (08-31)回复
  17. #1

    mark

    solfKwolf9个月前 (07-25)回复

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

立即前往
博聚网