安装插件
1.pnpm i qrcode
引入
2.import QRCode from 'qrcode'
使用,将要转换的字符串放进去
3.QRCode.toDataURL('I am a pony!')
import QRCode from 'qrcode'
// 会返回一个promise对象
QRCode.toDataURL('I am a pony!')
.then(url => {
console.log(url)
})
.catch(err => {
console.error(err)
})