zl程序教程

您现在的位置是:首页 >  后端

当前栏目

qrcode插件生成二维码

插件 生成 二维码 Qrcode
2023-09-11 14:19:39 时间

 

安装:

npm install --save qrcode

引入:

import QRCode from 'qrcode'

使用;

//触发事件调用下面的方法
// With promises
QRCode.toDataURL('http://jd.com/')
  .then(url => {
    console.log(url)
    this.imrUrl=url;
  })
  .catch(err => {
    console.error(err)
  })

 img使用:

<img v-if="qrcodeUrl" :src="qrcodeUrl" alt="">

 

.