herbluo / qr-code-with-logo Goto Github PK
View Code? Open in Web Editor NEW带头像(logo)的二维码(qrcode)生成工具,无jQuery依赖,自由调整大小
带头像(logo)的二维码(qrcode)生成工具,无jQuery依赖,自由调整大小
import QrCodeWithLogo from 'qr-code-with-logo'
import LocalImage from './Avatar.png'
const myCanvas = document.createElement('canvas')
// append应该是myCanvas
document.getElementsByTagName('body')[0].appendChild(canvas)
QrCodeWithLogo.toCanvas({
canvas: myCanvas,
content: 'https://cdn.blog.cloudself.cn',
width: 380,
logo: {
src: LocalImage,
// src: 'https://cdn.blog.cloudself.cn/images/avatar.png',
radius: 8
}
})
请问下是否支持添加二维码背景
亲你好,要如何设置二维码的logo大小呢?我想设置为96px的logo,不过程序好像不允许啊。谢谢
放到其他dom节点下就不行?
用了本地的相对路径地址,似乎取不到?
亲 你好,我的canvas背景已有别的图片。然后我想把二维码放在背景的正中间,有办法做到吗?我试了可是放了二维码之后,背景就整个不见了。谢谢帮忙
在 node 端安装 node-canvas 去实现 logo 图的时候,源码有依赖 document 就会执行出错,如果可以支持 node-canvas 就挺好的
二维码生成自带了一个border或者说padding 不能放出设置么
纠错级别也蛮重要的吧 这个其实可以放出来设置
2022-2-25测试
使用logo为本地./资源,不能设置圆角,否则空白logo
使用外链logo,可以正常设置显示圆角logo二维码
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.