HomeDocs
Skip to main content

Show Modal Dialog

methodName: showModal

Additional Parameters:

PropertyTypeRequiredDefaultDescription
titleStringNoThe specified title.
contentStringNoThe content of the dialog.
showCancelBooleanNofalseWhether to show the cancel button.
editableBooleanNofalseWhether to show an input field.
placeholderTextStringNoThe placeholder text when an input field is shown.
cancelTextStringNo"Cancel"The text for the cancel button, up to 12 characters.
cancelColorStringNo"#92969E"The text color for the cancel button in hexadecimal format.
confirmTextStringNo"Confirm"The text for the confirm button, up to 12 English characters.
confirmColorStringNo"#0081FF"The text color for the confirm button in hexadecimal format.

Success Callback Function

Parameters

Object res

PropertyTypeDescription
confirmBooleanWhen confirm is true, it indicates that the user clicked the confirm button.
cancelBooleanWhen 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).
contentStringWhen editable is true, this contains the text entered by the user.
successStringDescribes whether the interface call was successful or not. "true" for success, "false" for failure.

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('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);
},
});
}
Privacy agreementDeveloper agreementcontact us: developer_service.mi@transsion.com © 2024 MiniApp. All Rights Reserved.