perf: improve destroyOnClose for VbenDrawer&VbenModal (#6051)

* fix: fix that the default value of modal destroyOnClose does not take effect

* perf: improve destroyOnClose for VbenDrawer
This commit is contained in:
ming4762
2025-04-27 11:26:50 +08:00
committed by GitHub
parent 0a9fc4e02d
commit 0cc1cb5a7b
5 changed files with 64 additions and 11 deletions

View File

@@ -17,7 +17,9 @@ import VbenModal from './modal.vue';
const USER_MODAL_INJECT_KEY = Symbol('VBEN_MODAL_INJECT');
const DEFAULT_MODAL_PROPS: Partial<ModalProps> = {};
const DEFAULT_MODAL_PROPS: Partial<ModalProps> = {
destroyOnClose: true,
};
export function setDefaultModalProps(props: Partial<ModalProps>) {
Object.assign(DEFAULT_MODAL_PROPS, props);
@@ -86,7 +88,7 @@ export function useVbenModal<TParentModalProps extends ModalProps = ModalProps>(
mergedOptions.onClosed = () => {
options.onClosed?.();
if (options.destroyOnClose) {
if (mergedOptions.destroyOnClose) {
injectData.reCreateModal?.();
}
};