You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.4 KiB

feat: New Component QRCode (#38948) * feat: qrcode * chore: code clean * feat: New Component Qr-Code (#38891) * feat: QrCode * fix * fix * fix: fix bug * fix: fix bug * fix * fix * fix * delete * delete * test case * fix lint * bundlesize * demo * fix: fix test * remove dep * update snap * en docs * refactor: rename tests dir * Update components/qr-code/demo/base.md Co-authored-by: MadCcc <1075746765@qq.com> * Update components/qr-code/demo/base.md Co-authored-by: MadCcc <1075746765@qq.com> * Update components/qr-code/demo/download.md Co-authored-by: MadCcc <1075746765@qq.com> * Update components/qr-code/demo/download.md Co-authored-by: MadCcc <1075746765@qq.com> * Update components/qr-code/demo/download.tsx Co-authored-by: MadCcc <1075746765@qq.com> * Update components/qr-code/demo/logo.md Co-authored-by: MadCcc <1075746765@qq.com> * Update components/qr-code/index.tsx Co-authored-by: MadCcc <1075746765@qq.com> * Update components/qr-code/style/index.ts Co-authored-by: MadCcc <1075746765@qq.com> * Update components/qr-code/style/index.ts Co-authored-by: MadCcc <1075746765@qq.com> * Update components/qr-code/demo/logo.md Co-authored-by: MadCcc <1075746765@qq.com> * rename * fix * adjust text * rename * fix title * rename * rename * fix: snap * fix * bundlesize * update demo * update docs * add demo * add docs * add docs * test: add warning * update demo * bundlesize * update test case * update demo * feat: add onRefresh、add status * fix: fix demo * fix: fix demo * add locale * add locale * add test case * update snap * fix demo * update demo * update demo * update demo * Update components/qrcode/style/index.ts Co-authored-by: MadCcc <1075746765@qq.com> * Update components/qrcode/style/index.ts Co-authored-by: MadCcc <1075746765@qq.com> * Update components/qrcode/style/index.ts Co-authored-by: MadCcc <1075746765@qq.com> * Update components/qrcode/style/index.ts Co-authored-by: MadCcc <1075746765@qq.com> * Update components/qrcode/style/index.ts Co-authored-by: MadCcc <1075746765@qq.com> * Update components/qrcode/interface.ts Co-authored-by: MadCcc <1075746765@qq.com> * Update components/qrcode/style/index.ts Co-authored-by: MadCcc <1075746765@qq.com> * fix * Update components/qrcode/index.tsx Co-authored-by: MadCcc <1075746765@qq.com> * fix * fix * fix * add decs * fix * fix * fix type * fix * fix demo * fix lint * fix lint * add test case for bordered * prettier-ignore Co-authored-by: MadCcc <1075746765@qq.com> Co-authored-by: 栗嘉男 <lijianan@lijianandeMacBook-Pro.local>
2 years ago
---
category: Components
title: QRCode
cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*cJopQrf0ncwAAAAAAAAAAAAADrJ8AQ/original
demo:
cols: 2
group:
title: Data Display
order: 5
---
Components that can convert links into QR codes, and support custom color and logo. Available since `antd@5.1.0`.
<Alert message="If the QR code cannot be scanned for identification, it may be because the link address is too long, which leads to too dense pixels. You can configure the QR code to be larger through `size`, or shorten the link through short link services."></Alert>
## When To Use
Used when the link needs to be converted into a QR Code.
## Examples
<!-- prettier-ignore -->
<code src="./demo/base.tsx">base</code>
<code src="./demo/icon.tsx">With Icon</code>
<code src="./demo/status.tsx">other status</code>
feat: New Component QRCode (#38948) * feat: qrcode * chore: code clean * feat: New Component Qr-Code (#38891) * feat: QrCode * fix * fix * fix: fix bug * fix: fix bug * fix * fix * fix * delete * delete * test case * fix lint * bundlesize * demo * fix: fix test * remove dep * update snap * en docs * refactor: rename tests dir * Update components/qr-code/demo/base.md Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/demo/base.md Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/demo/download.md Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/demo/download.md Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/demo/download.tsx Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/demo/logo.md Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/index.tsx Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/style/index.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/style/index.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/demo/logo.md Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * rename * fix * adjust text * rename * fix title * rename * rename * fix: snap * fix * bundlesize * update demo * update docs * add demo * add docs * add docs * test: add warning * update demo * bundlesize * update test case * update demo * feat: add onRefresh、add status * fix: fix demo * fix: fix demo * add locale * add locale * add test case * update snap * fix demo * update demo * update demo * update demo * Update components/qrcode/style/index.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qrcode/style/index.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qrcode/style/index.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qrcode/style/index.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qrcode/style/index.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qrcode/interface.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qrcode/style/index.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * fix * Update components/qrcode/index.tsx Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * fix * fix * fix * add decs * fix * fix * fix type * fix * fix demo * fix lint * fix lint * add test case for bordered * prettier-ignore Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; Co-authored-by: 栗嘉男 &lt;lijianan@lijianandeMacBook-Pro.local&gt;
2 years ago
<code src="./demo/customSize.tsx">Custom Size</code>
<code src="./demo/customColor.tsx">Custom Color</code>
<code src="./demo/download.tsx">Download QRCode</code>
<code src="./demo/errorlevel.tsx">Error Level</code>
<code src="./demo/Popover.tsx">Advanced Usage</code>
## API
> This component is available since `antd@5.1.0`
| Property | Description | Type | Default |
| :-- | :-- | :-- | :-- |
| value | scanned link | string | - |
| icon | include image url (only image link are supported) | string | - |
| size | QRCode size | number | 128 |
| iconSize | include image size | number | 32 |
| color | QRCode Color | string | `#000` |
| bordered | Whether has border style | boolean | `true` |
| errorLevel | Error Code Level | `'L' \| 'M' \| 'Q' \| 'H' ` | `M` |
| status | QRCode status | `active \| expired \| loading ` | `active` |
feat: New Component QRCode (#38948) * feat: qrcode * chore: code clean * feat: New Component Qr-Code (#38891) * feat: QrCode * fix * fix * fix: fix bug * fix: fix bug * fix * fix * fix * delete * delete * test case * fix lint * bundlesize * demo * fix: fix test * remove dep * update snap * en docs * refactor: rename tests dir * Update components/qr-code/demo/base.md Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/demo/base.md Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/demo/download.md Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/demo/download.md Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/demo/download.tsx Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/demo/logo.md Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/index.tsx Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/style/index.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/style/index.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qr-code/demo/logo.md Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * rename * fix * adjust text * rename * fix title * rename * rename * fix: snap * fix * bundlesize * update demo * update docs * add demo * add docs * add docs * test: add warning * update demo * bundlesize * update test case * update demo * feat: add onRefresh、add status * fix: fix demo * fix: fix demo * add locale * add locale * add test case * update snap * fix demo * update demo * update demo * update demo * Update components/qrcode/style/index.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qrcode/style/index.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qrcode/style/index.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qrcode/style/index.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qrcode/style/index.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qrcode/interface.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * Update components/qrcode/style/index.ts Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * fix * Update components/qrcode/index.tsx Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; * fix * fix * fix * add decs * fix * fix * fix type * fix * fix demo * fix lint * fix lint * add test case for bordered * prettier-ignore Co-authored-by: MadCcc &lt;1075746765@qq.com&gt; Co-authored-by: 栗嘉男 &lt;lijianan@lijianandeMacBook-Pro.local&gt;
2 years ago
| onRefresh | callback | `() => void` | - |
## FAQ
### About QRCode ErrorLevel
The ErrorLevel means that the QR code can be scanned normally after being blocked, and the maximum area that can be blocked is the error correction rate.
Generally, the QR code is divided into 4 error correction levels: Level `L` can correct about `7%` errors, Level `M` can correct about `15%` errors, Level `Q` can correct about `25%` errors, and Level `H` can correct about `30%` errors. When the content encoding of the QR code carries less information, in other words, when the value link is short, set different error correction levels, and the generated image will not change.
> For more information, see the: [https://www.qrcode.com/en/about/error_correction](https://www.qrcode.com/en/about/error_correction.html)