diff --git a/packages/vant/src/dialog/Dialog.tsx b/packages/vant/src/dialog/Dialog.tsx index d825de574da..e94c475a00a 100644 --- a/packages/vant/src/dialog/Dialog.tsx +++ b/packages/vant/src/dialog/Dialog.tsx @@ -63,6 +63,7 @@ export const dialogProps = extend({}, popupSharedProps, { showConfirmButton: truthProp, closeOnClickOverlay: Boolean, keyboardEnabled: truthProp, + destroyOnClose: Boolean, }); export type DialogProps = ExtractPropTypes; @@ -71,6 +72,7 @@ const popupInheritKeys = [ ...popupSharedPropKeys, 'transition', 'closeOnPopstate', + 'destroyOnClose', ] as const; export default defineComponent({ diff --git a/packages/vant/src/dialog/README.md b/packages/vant/src/dialog/README.md index 58d0308be36..144429a5488 100644 --- a/packages/vant/src/dialog/README.md +++ b/packages/vant/src/dialog/README.md @@ -172,6 +172,7 @@ Vant exports following Dialog utility functions: | confirmButtonText | Confirm button text | _string_ | `Confirm` | | confirmButtonColor | Confirm button color | _string_ | `#ee0a24` | | confirmButtonDisabled | Whether to disable confirm button | _boolean_ | `false` | +| destroyOnClose `v4.9.18` | Whether to destroy content when closed | _boolean_ | `false` | | overlay | Whether to show overlay | _boolean_ | `true` | | overlayClass | Custom overlay class | _string \| Array \| object_ | - | | overlayStyle | Custom overlay style | _object_ | - | @@ -202,6 +203,7 @@ Vant exports following Dialog utility functions: | confirm-button-text | Confirm button text | _string_ | `Confirm` | | confirm-button-color | Confirm button color | _string_ | `#ee0a24` | | confirm-button-disabled | Whether to disable confirm button | _boolean_ | `false` | +| destroy-on-close `v4.9.18` | Whether to destroy content when closed | _boolean_ | `false` | | z-index | Set the z-index to a fixed value | _number \| string_ | `2000+` | | overlay | Whether to show overlay | _boolean_ | `true` | | overlay-class | Custom overlay class | _string_ | - | diff --git a/packages/vant/src/dialog/README.zh-CN.md b/packages/vant/src/dialog/README.zh-CN.md index 505da72fe6b..7bf9dfd1baf 100644 --- a/packages/vant/src/dialog/README.zh-CN.md +++ b/packages/vant/src/dialog/README.zh-CN.md @@ -172,6 +172,7 @@ Vant 中导出了以下 Dialog 相关的辅助函数: | cancelButtonText | 取消按钮文案 | _string_ | `取消` | | cancelButtonColor | 取消按钮颜色 | _string_ | `black` | | cancelButtonDisabled | 是否禁用取消按钮 | _boolean_ | `false` | +| destroyOnClose `v4.9.18` | 是否在关闭时销毁内容 | _boolean_ | `false` | | overlay | 是否展示遮罩层 | _boolean_ | `true` | | overlayClass | 自定义遮罩层类名 | _string \| Array \| object_ | - | | overlayStyle | 自定义遮罩层样式 | _object_ | - | @@ -204,6 +205,7 @@ Vant 中导出了以下 Dialog 相关的辅助函数: | cancel-button-text | 取消按钮文案 | _string_ | `取消` | | cancel-button-color | 取消按钮颜色 | _string_ | `black` | | cancel-button-disabled | 是否禁用取消按钮 | _boolean_ | `false` | +| destroy-on-close `v4.9.18` | 是否在关闭时销毁内容 | _boolean_ | `false` | | z-index | 将弹窗的 z-index 层级设置为一个固定值 | _number \| string_ | `2000+` | | overlay | 是否展示遮罩层 | _boolean_ | `true` | | overlay-class | 自定义遮罩层类名 | _string_ | - | diff --git a/packages/vant/src/dialog/function-call.tsx b/packages/vant/src/dialog/function-call.tsx index e6e5a8949f4..3b446f1affe 100644 --- a/packages/vant/src/dialog/function-call.tsx +++ b/packages/vant/src/dialog/function-call.tsx @@ -31,6 +31,7 @@ const DEFAULT_OPTIONS = { showCancelButton: false, closeOnPopstate: true, closeOnClickOverlay: false, + destroyOnClose: false, } as const; let currentOptions = extend({}, DEFAULT_OPTIONS);