生成二维码插件---qrcode

用法:
1.下包: npm install --save qrcodegit

2.导包: import QRCode from 'qrcode'npm

3.用包:this

<template>
  <div>
    <img :src="src" alt="" />
  </div>
</template>

<script>
import QRCode from 'qrcode'
export default {
  data () {
    return {
      src: ''
    }
  },
  mounted () {
    // QRCode.toDataURL(
    //   'https://vant-contrib.gitee.io/vant/#/zh-CN/popup',
    //   (err, url) => {
    //     console.log(url)
    //     this.src = url
    //   }
    // )
    QRCode.toDataURL('https://vant-contrib.gitee.io/vant/#/zh-CN/popup').then(
      url => {
        this.src = url
      }
    )
  }
}
</script>

<style></style>

连接:
npm-qrcode:https://www.npmjs.com/package/qrcodeurl

相关文章
相关标签/搜索