From 3e522d35e6007a09b29df777e70d2a2f52dfa1b6 Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 2 Oct 2019 19:53:00 +0800 Subject: [PATCH] feat(Dialog): add transition prop (#4636) --- src/dialog/Dialog.js | 6 +++++- src/dialog/README.md | 2 ++ src/dialog/README.zh-CN.md | 2 ++ src/dialog/index.js | 1 + types/dialog.d.ts | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/dialog/Dialog.js b/src/dialog/Dialog.js index 8f587b964..d1e022a60 100644 --- a/src/dialog/Dialog.js +++ b/src/dialog/Dialog.js @@ -21,6 +21,10 @@ export default createComponent({ confirmButtonText: String, confirmButtonColor: String, showCancelButton: Boolean, + transition: { + type: String, + default: 'van-dialog-bounce' + }, showConfirmButton: { type: Boolean, default: true @@ -140,7 +144,7 @@ export default createComponent({ return ( diff --git a/src/dialog/README.md b/src/dialog/README.md index 1ee85749e..b153c2410 100644 --- a/src/dialog/README.md +++ b/src/dialog/README.md @@ -133,6 +133,7 @@ export default { | closeOnClickOverlay | Whether to close when click overlay | *boolean* | `false` | - | | lockScroll | Whether to lock body scroll | *boolean* | `true` | - | | beforeClose | Callback before close,
call done() to close dialog,
call done(false) to cancel loading | (action: string, done: Function) => void | - | - | +| transition | Transition, equivalent to `name` prop of [transtion](https://vuejs.org/v2/api/#transition) | *string* | - | 2.2.6 | | getContainer | Return the mount node for Dialog | *string \| () => Element* | `body` | - | ### Props @@ -154,6 +155,7 @@ export default { | close-on-click-overlay | Whether to close when click overlay | *boolean* | `false` | - | | lock-scroll | Whether to lock background scroll | *boolean* | `true` | - | | before-close | Callback before close,
call done() to close dialog,
call done(false) to cancel loading | (action: string, done: Function) => void | - | - | +| transition | Transition, equivalent to `name` prop of [transtion](https://vuejs.org/v2/api/#transition) | *string* | - | 2.2.6 | | get-container | Return the mount node for Dialog | *string \| () => Element* | - | - | ### Events diff --git a/src/dialog/README.zh-CN.md b/src/dialog/README.zh-CN.md index d72817e15..b9db34a6f 100644 --- a/src/dialog/README.zh-CN.md +++ b/src/dialog/README.zh-CN.md @@ -162,6 +162,7 @@ export default { | closeOnClickOverlay | 是否在点击遮罩层后关闭弹窗 | *boolean* | `false` | - | | lockScroll | 是否锁定背景滚动 | *boolean* | `true` | - | | beforeClose | 关闭前的回调函数,
调用 done() 后关闭弹窗,
调用 done(false) 阻止弹窗关闭 | *(action, done) => void* | - | - | +| transition | 动画类名,等价于 [transtion](https://cn.vuejs.org/v2/api/index.html#transition) 的`name`属性 | *string* | - | 2.2.6 | | getContainer | 指定挂载的节点,可以传入选择器,
或一个返回节点的函数 | *string \| () => Element* | `body` | - | ### Props @@ -185,6 +186,7 @@ export default { | close-on-click-overlay | 是否在点击遮罩层后关闭弹窗 | *boolean* | `false` | - | | lock-scroll | 是否锁定背景滚动 | *boolean* | `true` | - | | before-close | 关闭前的回调函数,
调用 done() 后关闭弹窗,
调用 done(false) 阻止弹窗关闭 | *(action, done) => void* | - | - | +| transition | 动画类名,等价于 [transtion](https://cn.vuejs.org/v2/api/index.html#transition) 的`name`属性 | *string* | - | 2.2.6 | | get-container | 指定挂载的节点,可以传入选择器,
或一个返回节点的函数 | *string \| () => Element* | - | - | ### Events diff --git a/src/dialog/index.js b/src/dialog/index.js index d61c12a57..013a61b2c 100644 --- a/src/dialog/index.js +++ b/src/dialog/index.js @@ -51,6 +51,7 @@ Dialog.defaultOptions = { overlay: true, className: '', lockScroll: true, + transition: 'van-dialog-bounce', beforeClose: null, messageAlign: '', getContainer: 'body', diff --git a/types/dialog.d.ts b/types/dialog.d.ts index e19a64194..ab7920418 100644 --- a/types/dialog.d.ts +++ b/types/dialog.d.ts @@ -7,6 +7,7 @@ export type DialogOptions = { overlay?: boolean; className?: any; lockScroll?: boolean; + transition?: string; messageAlign?: string; closeOnPopstate?: boolean; cancelButtonText?: string;