Launch the Client's Scan Code Interface for Scanning
methodName: scanCode
Additional Parameters:
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
| onlyFromCamera | Boolean | Yes | Whether to support selecting scan code files from the image library | |
| autoJump | Boolean | No | Whether to automatically jump to the mini-program when a QR code is recognized (default is automatic) | |
| sceneId | Boolean | No | Scene value |
Success Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| success | String | Describes whether the interface call was successful or not. "true" for success, "false" for failure |
| data | String | Scan code result |
| autoJump | Boolean | Whether the mini-program has automatically jumped |
Fail Callback Function
Parameters
Object res
| Property | Type | Description |
|---|---|---|
| success | String | Describes whether the interface call was successful or not. "true" for success, "false" for failure |
| errMsg | String | Error message |
Example Usage
const dlt = window['@transsion/byteh5bridge'];
const canCallDlt = dlt && window.dltms && window.dltms.isMiniShellGame();
if (canCallDlt) {
dlt.callApi('scanCode', {
onlyFromCamera: true,
success: (res) => {
console.log('Success: ', res);
},
fail: (res) => {
console.log('Fail: ', res);
},
complete: (res) => {
console.log('Complete: ', res);
},
});
}