Show Modal Dialog
methodName: showModal
Additional Parameters:
Property | Type | Required | Default | Description |
---|---|---|---|---|
title | String | No | The specified title. | |
content | String | No | The content of the dialog. | |
showCancel | Boolean | No | false | Whether to show the cancel button. |
editable | Boolean | No | false | Whether to show an input field. |
placeholderText | String | No | The placeholder text when an input field is shown. | |
cancelText | String | No | "Cancel" | The text for the cancel button, up to 12 characters. |
cancelColor | String | No | "#92969E" | The text color for the cancel button in hexadecimal format. |
confirmText | String | No | "Confirm" | The text for the confirm button, up to 12 English characters. |
confirmColor | String | No | "#0081FF" | The text color for the confirm button in hexadecimal format. |
Success Callback Function
Parameters
Object res
Property | Type | Description |
---|---|---|
confirm | Boolean | When confirm is true, it indicates that the user clicked the confirm button. |
cancel | Boolean | When cancel is true, it indicates that the user clicked the cancel button (used to distinguish between closing by tapping the mask or the cancel button on Android systems). |
content | String | When editable is true, this contains the text entered by the user. |
success | String | Describes whether the interface call was successful or not. "true" for success, "false" for failure. |
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('showModal', {
title: 'Modal Title',
content: 'Modal Content',
showCancel: true,
success: (res) => {
console.log('Success: ', res);
},
fail: (res) => {
console.log('Fail: ', res);
},
complete: (res) => {
console.log('Complete: ', res);
},
});
}