Home >WeChat Applet >Mini Program Development >WeChat applet component: action-sheet displays operation menu interpretation and analysis

WeChat applet component: action-sheet displays operation menu interpretation and analysis

高洛峰
高洛峰Original
2018-05-25 13:53:417827browse

action-sheet Displays the component description of the action menu:

  • Display action menu

action-sheetDisplay action menuSample code run The effect is as follows:

WeChat applet component: action-sheet displays operation menu interpretation and analysis

#The following is the WXML code:

# #

<button>弹出ActionSheet</button>

The following is the JS code:

##

actionSheetTap: function () {
    var itemList= ['A', 'B', 'C']
    wx.showActionSheet({
      itemList:itemList,
      success: function (res) {
        if (!res.cancel) {
          console.log(itemList[res.tapIndex])
        }
      }
    })
  }

action-sheet displays the main properties of the action menu:

OBJECT parameter description:
##AttributesString ArrayHexColor##successFunctionNoThe interface calls the callback function successfully, please see the return parameter description for detailsfailFunctionNo Callback function for interface call failurecompleteFunctionNoCallback function for end of interface call Function (executed successfully or failed) success return parameter description:

Type

Required

Description

itemList
is the text array of the button. The maximum length of the array is 6 itemColor
No The text color of the button, the default is "#000000"
ParametersBooleanWhether the user cancels the selectiontapIndexNumberThe button the user clicked, In order from top to bottom, starting from 0
Type

Description

cancel

The above is the detailed content of WeChat applet component: action-sheet displays operation menu interpretation and analysis. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn