用法:
1.下包: npm install --save qrcode
git
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