用法:
1.下包: npm install --save qrcode
2.导包: import QRCode from 'qrcode'
3.用包:
<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/qrcode