vite v4.5.0 building for production...
✓ 1 modules transformed.
dist/youloge.qrcode.es.js 20.41 kB │ gzip: 5.45 kB
dist/youloge.qrcode.umd.js 14.39 kB │ gzip: 4.84 kB
✓ built in 171ms
- 💡 组件库有作用域前缀
youloge
- ⚡️ 建议直接引入CDN 即可使用 14.39 kB │ gzip: 4.84 kB
- 🛠️
https://unpkg.com/youloge.qrcode
- 📦
https://cdn.jsdelivr.net/npm/youloge.qrcode
- 🔩 调用
youloge.qrcode(TEXT)
- 🔑
youloge.qrcode('TEXT',options={}).then(canvas=>{
document.body.appendChild(canvas)
}).catch(err=>{
console.log(err)
})
{
text: '',
width: 256,
height: 256,
typeNumber: -1,
background: "#ffffff",
foreground: "#000000",
}
youloge.qrcode(qrcode).then(canvas=>{
canvas.toBlob((blob)=>{
var file = new Blob([blob], {type: "image/png;charset=utf-8"});
var src = URL.createObjectURL(file);
document.querySelector("img").src = src
},"image/png", 0.95)
})
~ 就这!