npm install @uni/action-sheet

Displays the operation menu.

``bash`
$ npm install @uni/action-sheet --save`
orbash`
$ npm install @uni/apis --saveUsage
`javascript
import showActionSheet from '@uni/action-sheet';
showActionSheet({
itemList: ['A', 'B', 'C'],
success (res) {
console.log(res.tapIndex)
},
fail (res) {
console.log(res.errMsg)
}
});
// promise
showActionSheet({
itemList: ['A', 'B', 'C']
}).then(res => {
console.log(res.tapIndex)
});
`
You can also import from the big package:
`js`
import { actionSheet } from '@uni/apis';
actionSheet({
itemList: ['A', 'B', 'C']
}).then(res => {
console.log(res.tapIndex)
});
#### Arguments
| Property | Type | Description | required | Default |
| --- | --- | --- | --- | --- |
| options | object | | ✔️ | - |Array
| options.itemList | | The text array of the button, with a length limited to 6 | ✔️ | - |Function
| options.success | | The callback function for a successful API call | ✘ | - |Function
| options.fail | | The callback function for a failed API call | ✘ | - |Function
| options.complete | | The callback function used when the API call completed (always executed whether the call succeeds or fails) | ✘ | - |
#### Special Arguments
| Property | Type | Description | required | Default | Supported |
| --- | --- | --- | --- | --- | -- |
| options.title | string | The title of actionsheet | ✘ | | string |
| options.alertText | | The alert text | ✘ | | string 2.14.0 |
| options.itemColor | | The text color of the button | ✘ | #000000 | string
|
| options.cancelButtonText | | The text of cancel button | ✘ | cancel | number |
| options.destructiveBtnIndex | | get more on ali document | ✘ | | Array no Dingding |
| options.badges |
#### Return
| Property | Type | Description |
| --- | --- | --- |
| tapIndex | number` | The sequence number of the button tapped by the user, from top to bottom and starting from 0, The value is -1 when the mask or cancel button is clicked by the user |
