[new feature] ActionSheet: add open、close events (#3639)

This commit is contained in:
neverland 2019-06-26 14:14:43 +08:00 committed by GitHub
parent c4512dbc26
commit c6f8fca41f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 11 deletions

View File

@ -112,6 +112,10 @@ export default {
| select | Triggered when click option | item, index |
| cancel | Triggered when cancel click | - |
| click-overlay | Triggered when click overlay | - |
| open | Triggered when open ActionSheet | - |
| opened | Triggered when opened ActionSheet | - |
| close | Triggered when close ActionSheet | - |
| closed | Triggered when closed ActionSheet | - |
### Data struct of actions

View File

@ -38,14 +38,6 @@ function ActionSheet(
) {
const { title, cancelText } = props;
function onInput(value: boolean) {
emit(ctx, 'input', value);
}
function onClickOverlay() {
emit(ctx, 'click-overlay');
}
function onCancel() {
emit(ctx, 'input', false);
emit(ctx, 'cancel');
@ -131,9 +123,7 @@ function ActionSheet(
lockScroll={props.lockScroll}
getContainer={props.getContainer}
closeOnClickOverlay={props.closeOnClickOverlay}
onInput={onInput}
onClick-overlay={onClickOverlay}
{...inherit(ctx)}
{...inherit(ctx, true)}
>
{Header()}
{props.actions.map(Option)}

View File

@ -119,6 +119,10 @@ export default {
| select | 选中选项时触发,禁用或加载状态下不会触发 | item: 选项对应的对象, index: 选择对应的索引 |
| cancel | 取消按钮点击时触发 | - |
| click-overlay | 点击遮罩层时触发 | - |
| open | 打开菜单时触发 | - |
| opened | 打开菜单且动画结束后触发 | - |
| close | 关闭菜单时触发 | - |
| closed | 关闭菜单且动画结束后触发 | - |
### actions