Merge branch 'main' of https://github.com/vbenjs/vue-vben-admin into v-next-dev

This commit is contained in:
xingyu4j
2025-04-22 15:39:53 +08:00
38 changed files with 815 additions and 424 deletions

View File

@@ -103,7 +103,7 @@ const { dragging, transform } = useModalDraggable(
);
const firstOpened = ref(false);
const isClosed = ref(false);
const isClosed = ref(true);
watch(
() => state?.value?.isOpen,
@@ -186,7 +186,7 @@ const getAppendTo = computed(() => {
});
const getForceMount = computed(() => {
return !unref(destroyOnClose);
return !unref(destroyOnClose) && unref(firstOpened);
});
function handleClosed() {
@@ -321,7 +321,7 @@ function handleClosed() {
{{ cancelText || $t('cancel') }}
</slot>
</component>
<slot name="center-footer"></slot>
<component
:is="components.PrimaryButton || VbenButton"
v-if="showConfirmButton"

View File

@@ -70,6 +70,13 @@ export function useVbenModal<TParentModalProps extends ModalProps = ModalProps>(
injectData.options?.onOpenChange?.(isOpen);
};
mergedOptions.onClosed = () => {
options.onClosed?.();
if (options.destroyOnClose) {
injectData.reCreateModal?.();
}
};
const api = new ModalApi(mergedOptions);
const extendedApi: ExtendedModalApi = api as never;