# wx.showActionSheet(Object object)

Displays the operation menu.

# Parameters

# Object object

Attribute Type Default Required Description
itemList Array.<string> Yes The text array of the button, with a length limited to 6
itemColor string #000000 No The text color of the button
success function No The callback function for a successful API call
fail function No Callback function for failed API call
complete function No Callback function used when API call completed (always executed whether call succeeds or fails)

# object.success callback function

# Parameters
# Object res
Property Type Description
tapIndex number The sequence number of the button tapped by the user, from top to bottom and starting from 0

# Sample Code

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

# Notes

  • For Android 6.7.2 and below, when you tap Cancel or Mask, the callback will fail with the errMsg of "fail cancel".
  • For Android 6.7.2 & above and iOS, tapping Mask will not close the modal dialog box, so avoid using the "Cancel" branch to implement the business logic.
点击咨询小助手