# wx.showActionSheet(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 Action Menu

# parameter

# Object object

attribute type Default values Required Introductions Minimum version
alertText string no Warning copy 2.14.0
itemList Array.&ltstring&gt yes An array of text for ons whose maximum length is 6
itemColor string #000000 no Button text color
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
tapIndex number Number of ons the user clicks, from top to bottom, starting with 0

# sample code

wx.showActionSheet({
  itemList: ['A', 'B', 'C'],
  success (res) {
    console.log(res.tapIndex)
  },
  fail (res) {
    console.log(res.errMsg)
  }
})

# 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