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

NameTypeMandatoryDescription
titleStringNoTitle of prompt box
messageStringYesText of prompt box, which is “Enter contents here” by default
placeholderStringNoPrompt text for the entry box
alignStringNoMessage alignment, supporting enumeration left/center/right, iOS ‘center’, android ‘left’
okButtonTextStringNoOK button text, which is “OK” by default
cancelButtonTextStringNoOK button text, which is “Cancel” by default
successFunctionNoCallback function upon call success
failFunctionNoCallback function upon call failure
completeFunctionNoCallback 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:

NameTypeDescription
okBooleanClick OK to return true; click Cancel to return false
inputValueStringWhen OK is true, return the user's entry