lwj820876312
1,qrcanvas-vue插件,https://gera2ld.github.io/qrcanvas-vue/#logo。只支持像素大小的二维码



2,qrcode支持移动端自定义大小二维码


"qrcode": "^1.2.2",
import QRCode from \'qrcode\';


<div class="qrcode_box">
<canvas class="qrcode"></canvas>
</div>


_this.urlData为请求过来的url地址

渲染:
var canvas = document.querySelector(\'canvas\')
QRCode.toCanvas(canvas, this.urlData)

css:

生成二维码之后在canvas标签里有style样式(单位为px),!important的层级比style要高,实现自定义大小
.qrcode_box{
width: 4rem!important;
height: 4rem!important;
margin:rem(40) auto 0;
.qrcode{
width: 4rem!important;
height: 4rem!important;
}
}







分类:

技术点:

相关文章:

  • 2021-07-28
  • 2021-08-24
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2021-12-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
  • 2022-12-23
  • 2022-01-23
  • 2021-09-14
  • 2022-12-23
相关资源
相似解决方案