Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qrcodejs2生成二维码自适应 #4

Open
hsingyin opened this issue Feb 13, 2020 · 0 comments
Open

qrcodejs2生成二维码自适应 #4

hsingyin opened this issue Feb 13, 2020 · 0 comments

Comments

@hsingyin
Copy link
Owner

展码这样的需求场景十分常见,在二维码生成之后需要根据移动设备的宽高写自适应。但是问题来了,使用到的qrcodejs2,构造函数传入的宽高不是rem这样的单位。canvas的画布大小是固定的。为此使用曲线救国在生成二维码的节点下加入important样式。

 img,
 canvas {
     width: 3.8rem !important;
     height: 3.8rem !important;
 }

这样就可以实现二维码的自适应。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant