1 | # ActionSheet
|
2 |
|
3 | Action sheet component
|
4 |
|
5 | ![capture](https://chemzqm.me/images/04-10/actionsheet.jpeg)
|
6 |
|
7 | [demo](https://chemzqm.github.io/actionsheet)
|
8 |
|
9 | ## Install
|
10 |
|
11 | npm i actionsheet -S
|
12 |
|
13 | ## Example
|
14 |
|
15 | ``` js
|
16 | var as = require('actionsheet')
|
17 | event.bind(document.getElementById('demo'), 'touchstart', tap(function () {
|
18 | as({
|
19 | save: {
|
20 | text: 'save',
|
21 | callback: function () {
|
22 | notice('Save tapped', {duration: 2000})
|
23 | }
|
24 | },
|
25 | complain: {
|
26 | text: 'complain',
|
27 | callback: function () {
|
28 | notice('Complain tapped', {duration: 2000})
|
29 | }
|
30 | },
|
31 | cancel: {
|
32 | text: 'cancel'
|
33 | }
|
34 | }).then(function () {
|
35 | console.log('action sheet shown')
|
36 | })
|
37 | }))
|
38 | ```
|
39 |
|
40 | ## API
|
41 |
|
42 | ### Actionsheet(option)
|
43 |
|
44 | Init ActionSheet with `option`
|
45 | * `option` contains actions, key is action name.
|
46 | * `option.action` action contains `text` and `callback`.
|
47 | * `option.cancel` is special action, you can omit `callback` for it.
|
48 |
|
49 | ## License
|
50 |
|
51 | Copyright 2016 chemzqm@gmail.com
|
52 |
|
53 | Permission is hereby granted, free of charge, to any person obtaining
|
54 | a copy of this software and associated documentation files (the "Software"),
|
55 | to deal in the Software without restriction, including without limitation
|
56 | the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
57 | and/or sell copies of the Software, and to permit persons to whom the
|
58 | Software is furnished to do so, subject to the following conditions:
|
59 |
|
60 | The above copyright notice and this permission notice shall be included
|
61 | in all copies or substantial portions of the Software.
|
62 |
|
63 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
64 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
65 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
66 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
67 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
68 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
69 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|