[improvement] Actionsheet: add cancel event (#796)

This commit is contained in:
张敏
2018-03-29 11:43:21 +08:00
committed by GitHub
parent 99361427f9
commit 1c2b45503e
5 changed files with 29 additions and 3 deletions
+5 -1
View File
@@ -7,7 +7,7 @@
<demo-block :title="$t('title2')">
<van-button @click="show2 = true">{{ $t('button2') }}</van-button>
<van-actionsheet v-model="show2" :actions="actions" :cancel-text="$t('cancel')" />
<van-actionsheet v-model="show2" :actions="actions" :cancel-text="$t('cancel')" @cancel="handleCancel" />
</demo-block>
<demo-block :title="$t('title3')">
@@ -61,6 +61,10 @@ export default {
methods: {
onClick(item) {
Toast(item.name);
},
handleCancel() {
Toast('cancel');
}
}
};
+6
View File
@@ -72,6 +72,12 @@ Actionsheet will get another style if there is a `title` prop.
| close-on-click-overlay | Whether to close when click overlay | `Boolean` | - | - |
| get-container | Return the mount node for actionsheet | `Function` | - | `() => HTMLElement` |
### Event
| Event | Description | Arguments |
|-----------|-----------|-----------|
| cancel | Triggered when cancel click | - |
### Data struct of actions
| key | Description |
+6
View File
@@ -75,6 +75,12 @@ export default {
| close-on-click-overlay | 点击遮罩是否关闭`Actionsheet` | `Boolean` | - | - |
| get-container | 指定挂载的 HTML 节点 | `Function` | - | `() => HTMLElement` |
### Event
| 事件名 | 说明 | 参数 |
|-----------|-----------|-----------|
| cancel | 取消按钮点击时触发 | - |
### actions
`API`中的`actions`为一个对象数组,数组中的每一个对象配置每一列,每一列有以下`key`