welhzh

vue项目开发的时候经常会遇到需要将一个网址链接转化为二维码的需求,方便用户扫描观看,以下就是我在寻找vue二维码生成器的时候踩过的坑。

不能用的二维码生成器
    qrcode
    node-qrcode
    vue-qrcode
    qrcodejs2

建议使用 xkeshi/vue-qrcode,感谢知乎-vue二维码生成器

 

npm install xkeshi/vue-qrcode --save

 

 

组件中使用

 

 

<div v-show="qrcodeUrl" class="response">
    <qrcode :value="qrcodeUrl" v-if="qrcodeUrl" :options="{ size: 170 }"></qrcode>
    <p>请使用支付宝扫码支付</p>
</div>

 

// script
<script>
import QRcode from \'@xkeshi/vue-qrcode\'
export default {
    name :\'\',
    components::{
        qrcode : QRcode
    }
}
</script>

 

分类:

技术点:

相关文章:

  • 2021-11-07
  • 2021-06-08
  • 2021-12-03
  • 2021-12-09
  • 2021-12-23
  • 2021-11-17
  • 2021-12-19
猜你喜欢
  • 2022-01-13
  • 2021-10-12
  • 2021-11-07
  • 2021-12-23
  • 2021-09-13
  • 2021-12-13
相关资源
相似解决方案