# wx.showModal(Object object)

with Promise style call: Supported

Mini Program plugin: Support, need to Mini Program base library version no less than 1.9.6

Display modal dialog box

# parameter

# Object object

attribute type Default values Required Introductions Minimum version
title string no Title of Tip
content string no Content of the prompt
showCancel boolean true no Show Cancel Button
cancelText string cancel no Cancel on text, up to 4 Character
cancelColor string #000000 no The text color of the cancel on must be 16 Color strings in binary format
confirmText string determine no Confirm on text, up 4 Character
confirmColor string #初始值 no Confirm on text color, must be 16 Color strings in binary format
editable boolean false no Whether to display input box 2.17.1
placeholderText string no Prompt text when displaying input box 2.17.1
success function no Interface calls the successful callback function
fail function no Interface calls failed callback functions
complete function no Callback function at the end of an interface call (both successful and unsuccessful calls are executed)

# object.success callback

# parameter
# Object res
attribute type Introductions Minimum version
content string editable for true Text entered by the user
confirm boolean for true When the user clicks the OK on
cancel boolean for true Indicates that the user has clicked cancel for the Android The system distinguishes between clicking the mask to close or clicking the cancel on to close.) 1.1.0

# sample code

  title: "Hint"?
  content: 'This is a modal pop-up. '
  success (res) {
    if (res.confirm) {
      console.log("User clicks OK.")
    } else if (res.cancel) {
      console.log('User clicks to cancel '-)

# Be careful

  • Android 6.7.2 Following version, click cancel or mask when callback fail, errMsg for "fail cancel"
  • Android 6.7.2 And above version and iOS Clicking on the mask will not close the modal pop-up window, so try to avoid usingcancelImplement Business Logic in Branch
  • Self-base library 2.17.1 Version, support incoming editable Parameter to display pop-up window with input box