1.0.8 • Published 2 years ago
@uni/action-sheet v1.0.8
actionSheet
Displays the operation menu.
Supported
Install
$ npm install @uni/action-sheet --save
or
$ npm install @uni/apis --save
Usage
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:
import { actionSheet } from '@uni/apis';
actionSheet({
itemList: ['A', 'B', 'C']
}).then(res => {
console.log(res.tapIndex)
});
Methods
showActionSheet(options)
Arguments
Property | Type | Description | required | Default |
---|---|---|---|---|
options | object | ✔️ | - | |
options.itemList | Array<string> | The text array of the button, with a length limited to 6 | ✔️ | - |
options.success | Function | The callback function for a successful API call | ✘ | - |
options.fail | Function | The callback function for a failed API call | ✘ | - |
options.complete | Function | 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 | ✘ | ||
options.alertText | string | The alert text | ✘ | 2.14.0 | |
options.itemColor | string | The text color of the button | ✘ | #000000 | |
options.cancelButtonText | string | The text of cancel button | ✘ | cancel | |
options.destructiveBtnIndex | number | get more on ali document | ✘ | no Dingding | |
options.badges | Array<Object> | get more on ali document | ✘ | no Dingding |
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 |
1.0.8
2 years ago
1.0.7-beta
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.4-beta
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago
1.0.0-beta1
4 years ago
1.0.0-beta
4 years ago