HomeDocs
Skip to main content

Launch the Client's Scan Code Interface for Scanning

methodName: scanCode

Additional Parameters:

PropertyTypeRequiredDefaultDescription
onlyFromCameraBooleanYesWhether to support selecting scan code files from the image library
autoJumpBooleanNoWhether to automatically jump to the mini-program when a QR code is recognized (default is automatic)
sceneIdBooleanNoScene value

Success Callback Function

Parameters

Object res

PropertyTypeDescription
successStringDescribes whether the interface call was successful or not. "true" for success, "false" for failure
dataStringScan code result
autoJumpBooleanWhether the mini-program has automatically jumped

Fail Callback Function

Parameters

Object res

PropertyTypeDescription
successStringDescribes whether the interface call was successful or not. "true" for success, "false" for failure
errMsgStringError 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);
},
});
}
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.