my.prompt
Pop up a dialog to show the prompt message.
Sample Code
copy
my.prompt({
title: 'Title',
message: 'Explain the current status and prompt the user solution. It is best not to exceed two lines.',
placeholder: 'Leave a message to a friend',
okButtonText: 'Confirm',
cancelButtonText: 'Cancel',
success: (result) => {
my.alert({
title: JSON.stringify(result),
});
},
});
Parameters
Name | Type | Mandatory | Description |
title | String | No | Title of prompt box |
message | String | Yes | Text of prompt box, which is “Enter contents here” by default |
placeholder | String | No | Prompt text for the entry box |
align | String | No | Message alignment, supporting enumeration left/center/right, iOS ‘center’, android ‘left’ |
okButtonText | String | No | OK button text, which is “OK” by default |
cancelButtonText | String | No | OK button text, which is “Cancel” by default |
success | Function | No | Callback function upon call success |
fail | Function | No | Callback function upon call failure |
complete | Function | No | Callback function upon call completion (to be executed upon either call success or failure) |
Success Callback Function
The incoming parameter is of the Object type with the following attributes:
Name | Type | Description |
ok | Boolean | Click OK to return true; click Cancel to return false |
inputValue | String | When OK is true, return the user's entry |