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

[doc] add Q&A and typeNumber description #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Type: Object
| canvasId | 非必须,绘制的`canvasId` | `'myQrcode'` |
| ctx | 非必须,绘图上下文,可通过 `wx.createCanvasContext('canvasId')` 获取,v1.0.0+版本支持 | `'wx.createCanvasContext('canvasId')'` |
| text | 必须,二维码内容 | 'https://github.com/yingye' |
| typeNumber | 非必须,二维码的计算模式,默认值-1 | 8 |
| typeNumber | 非必须,二维码的计算模式,值越大允许的二维码内容越多,默认值-1(根据内容自动判断) | 8 |
| correctLevel | 非必须,二维码纠错级别,默认值为高级,取值:`{ L: 1, M: 0, Q: 3, H: 2 }` | 1 |
| background | 非必须,二维码背景颜色,默认值白色 | `'#ffffff'` |
| foreground | 非必须,二维码前景色,默认值黑色 | `'#000000'` |
Expand All @@ -91,6 +91,12 @@ Type: Object

<image src="./examples/api.png" width=500 height=500>

## Q&A

### 报错 `code length overflow`,或二维码过于稠密扫描不出来。

请修改 typeNumber 和 correctLevel 参数。

## TIPS

weapp.qrcode.js 二维码生成部分借鉴了 jquery-qrcode 源码,可以参考 [jquery-qrcode](https://github.com/jeromeetienne/jquery-qrcode)。