1.0.1 • Published 3 years ago
universal-action-sheet v1.0.1
showActionSheet
Displays the operation menu.
Supported
Install
$ npm install universal-showActionSheet --save
or
$ npm install universal-api --save
Usage
import showActionSheet from 'universal-showActionSheet';
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 { showActionSheet } from 'universal-api';
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) | ✘ | - |
Return
Property | Type | Description |
---|---|---|
tapIndex | number | The sequence number of the button tapped by the user, from top to bottom and starting from 0 |
/**
* iframe: true
*/
import React from 'react';
export default () => (
<iframe style={{
boxShadow: '0 2px 15px rgba(0,0,0,0.1)',
width: '375px',
height: '700px'
}} src='https://herbox.online/p/109000004/app_1aKtEd7SK?previewZoom=100&view=preview&defaultPage=pages/universal-action-sheet/index&topSlider=false'></iframe>
);