https://github.com/zpao/qrcode.react
npm install qrcode.react
组件的 props参数
| prop | type | default value |
|---|---|---|
| value | string | |
| renderAs | string (‘canvas’ ‘svg’) | ‘canvas’ |
| size | number | 128 |
| bgColor | string (CSS color) | “#FFFFFF” |
| fgColor | string (CSS color) | “#000000” |
| level | string (‘L’ ‘M’ ‘Q’ ‘H’) | ‘L’ |
| includeMargin | boolean | false |
| imageSettings | object (see below) |
二维码中间的图片参数
| field | type | default value |
|---|---|---|
| src | string | |
| x | number | none, will center |
| y | number | none, will center |
| height | number | 10% of size |
| width | number | 10% of size |
| excavate | boolean | false |
二维码参数配置
https://zpao.github.io/qrcode.react/
<QRCodevalue={"https://www.yuque.com/lulongwen/"}size={128}bgColor={"#ffffff"}fgColor={"#289af0"}level={"L"}includeMargin={true}renderAs={"svg"}imageSettings={{src: "https://gw.alipayobjects.com/zos/basement_prod/02f2a451-b7d9-49cd-a3bd-ddfe309e68d6.svg",x: null,y: null,height: 24,width: 24,excavate: true,}}/>
https://zhuanlan.zhihu.com/p/265086442
Qrcode 超出报错
Qrcode 字符串 URL 有长度限制,超出报错
- 纯中文最多 425个字符
- 纯英文 1276个字符
