feat(Dialog): add destroyOnClose prop to control content destruction on close (#13382)
This commit is contained in:
@@ -63,6 +63,7 @@ export const dialogProps = extend({}, popupSharedProps, {
|
|||||||
showConfirmButton: truthProp,
|
showConfirmButton: truthProp,
|
||||||
closeOnClickOverlay: Boolean,
|
closeOnClickOverlay: Boolean,
|
||||||
keyboardEnabled: truthProp,
|
keyboardEnabled: truthProp,
|
||||||
|
destroyOnClose: Boolean,
|
||||||
});
|
});
|
||||||
|
|
||||||
export type DialogProps = ExtractPropTypes<typeof dialogProps>;
|
export type DialogProps = ExtractPropTypes<typeof dialogProps>;
|
||||||
@@ -71,6 +72,7 @@ const popupInheritKeys = [
|
|||||||
...popupSharedPropKeys,
|
...popupSharedPropKeys,
|
||||||
'transition',
|
'transition',
|
||||||
'closeOnPopstate',
|
'closeOnPopstate',
|
||||||
|
'destroyOnClose',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ Vant exports following Dialog utility functions:
|
|||||||
| confirmButtonText | Confirm button text | _string_ | `Confirm` |
|
| confirmButtonText | Confirm button text | _string_ | `Confirm` |
|
||||||
| confirmButtonColor | Confirm button color | _string_ | `#ee0a24` |
|
| confirmButtonColor | Confirm button color | _string_ | `#ee0a24` |
|
||||||
| confirmButtonDisabled | Whether to disable confirm button | _boolean_ | `false` |
|
| 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` |
|
| overlay | Whether to show overlay | _boolean_ | `true` |
|
||||||
| overlayClass | Custom overlay class | _string \| Array \| object_ | - |
|
| overlayClass | Custom overlay class | _string \| Array \| object_ | - |
|
||||||
| overlayStyle | Custom overlay style | _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-text | Confirm button text | _string_ | `Confirm` |
|
||||||
| confirm-button-color | Confirm button color | _string_ | `#ee0a24` |
|
| confirm-button-color | Confirm button color | _string_ | `#ee0a24` |
|
||||||
| confirm-button-disabled | Whether to disable confirm button | _boolean_ | `false` |
|
| 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+` |
|
| z-index | Set the z-index to a fixed value | _number \| string_ | `2000+` |
|
||||||
| overlay | Whether to show overlay | _boolean_ | `true` |
|
| overlay | Whether to show overlay | _boolean_ | `true` |
|
||||||
| overlay-class | Custom overlay class | _string_ | - |
|
| overlay-class | Custom overlay class | _string_ | - |
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ Vant 中导出了以下 Dialog 相关的辅助函数:
|
|||||||
| cancelButtonText | 取消按钮文案 | _string_ | `取消` |
|
| cancelButtonText | 取消按钮文案 | _string_ | `取消` |
|
||||||
| cancelButtonColor | 取消按钮颜色 | _string_ | `black` |
|
| cancelButtonColor | 取消按钮颜色 | _string_ | `black` |
|
||||||
| cancelButtonDisabled | 是否禁用取消按钮 | _boolean_ | `false` |
|
| cancelButtonDisabled | 是否禁用取消按钮 | _boolean_ | `false` |
|
||||||
|
| destroyOnClose `v4.9.18` | 是否在关闭时销毁内容 | _boolean_ | `false` |
|
||||||
| overlay | 是否展示遮罩层 | _boolean_ | `true` |
|
| overlay | 是否展示遮罩层 | _boolean_ | `true` |
|
||||||
| overlayClass | 自定义遮罩层类名 | _string \| Array \| object_ | - |
|
| overlayClass | 自定义遮罩层类名 | _string \| Array \| object_ | - |
|
||||||
| overlayStyle | 自定义遮罩层样式 | _object_ | - |
|
| overlayStyle | 自定义遮罩层样式 | _object_ | - |
|
||||||
@@ -204,6 +205,7 @@ Vant 中导出了以下 Dialog 相关的辅助函数:
|
|||||||
| cancel-button-text | 取消按钮文案 | _string_ | `取消` |
|
| cancel-button-text | 取消按钮文案 | _string_ | `取消` |
|
||||||
| cancel-button-color | 取消按钮颜色 | _string_ | `black` |
|
| cancel-button-color | 取消按钮颜色 | _string_ | `black` |
|
||||||
| cancel-button-disabled | 是否禁用取消按钮 | _boolean_ | `false` |
|
| cancel-button-disabled | 是否禁用取消按钮 | _boolean_ | `false` |
|
||||||
|
| destroy-on-close `v4.9.18` | 是否在关闭时销毁内容 | _boolean_ | `false` |
|
||||||
| z-index | 将弹窗的 z-index 层级设置为一个固定值 | _number \| string_ | `2000+` |
|
| z-index | 将弹窗的 z-index 层级设置为一个固定值 | _number \| string_ | `2000+` |
|
||||||
| overlay | 是否展示遮罩层 | _boolean_ | `true` |
|
| overlay | 是否展示遮罩层 | _boolean_ | `true` |
|
||||||
| overlay-class | 自定义遮罩层类名 | _string_ | - |
|
| overlay-class | 自定义遮罩层类名 | _string_ | - |
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ const DEFAULT_OPTIONS = {
|
|||||||
showCancelButton: false,
|
showCancelButton: false,
|
||||||
closeOnPopstate: true,
|
closeOnPopstate: true,
|
||||||
closeOnClickOverlay: false,
|
closeOnClickOverlay: false,
|
||||||
|
destroyOnClose: false,
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
let currentOptions = extend({}, DEFAULT_OPTIONS);
|
let currentOptions = extend({}, DEFAULT_OPTIONS);
|
||||||
|
|||||||
Reference in New Issue
Block a user