scanCode(params: Object)
Requires:
BaseKit≥2.3.2@ray-js/ray≥0.3.23
Platforms:
iOSAndroid
Description
Launch the client scan UI for scanning. Note: On Android, only the result field is usable; other fields are meaningless.
Parameters
| Property | Type | Required | Default | Description | BaseKit Since |
|---|---|---|---|---|---|
onlyFromCamera | boolean | No | false | Whether to scan only using the camera; selecting images from the album is not allowed. | - |
isShowActionTitle | boolean | No | true | Whether to show the action title (Android only) | v3.3.3 |
isShowTorch | boolean | No | false | Whether to display the flashlight (Android only) | v3.3.3 |
isShowKeyboard | boolean | No | false | Whether to show the input for the setup code | v3.12.0 |
| No | - | Custom text for the setup-code input | v3.12.0 | ||
customTips | string | No | - | Custom prompt text (Android only) | v3.3.3 |
scanType | string[] | No | ["barCode", "qrCode"] | Scan type | - |
complete | () => void | No | - | Completion callback (executed on both success and failure) | - |
success | (params: Object) => void | No | - | Callback on successful API call | - |
fail | (params: Object) => void | No | - | Failure callback | - |
success callback parameters
| Property | Type | Description | BaseKit Since |
|---|---|---|---|
result | string | Scanned content | v3.2.6 |
scanType | string | Type of the scanned code | v3.2.6 |
charSet | string | Character set of the scanned code | v3.2.6 |
path | string | If the scanned code is the current Mini Program QR code, this field is returned with the QR code’s path (may be absent). | v3.2.6 |
rawData | string | Raw data, base64-encoded | v3.2.6 |
fail callback parameters
| Property | Type | Description |
|---|---|---|
errorMsg | string | Error message |
errorCode | string | number | Error code |
| Error extension |
Return Value
None