fix: when keepAlive is enabled, returning directly through browser buttons/gestures will not close pop ups (#6113)

pull/90/MERGE
LinaBell 2025-05-06 14:02:23 +08:00 committed by GitHub
parent 3b3f8e4e44
commit 8f4d3d418d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import {
h,
inject,
nextTick,
onDeactivated,
provide,
reactive,
ref,
@ -70,6 +71,14 @@ export function useVbenDrawer<
inheritAttrs: false,
},
);
/**
* keepAlive /
*/
onDeactivated(() => {
(extendedApi as ExtendedDrawerApi)?.close?.();
});
return [Drawer, extendedApi as ExtendedDrawerApi] as const;
}

View File

@ -5,6 +5,7 @@ import {
h,
inject,
nextTick,
onDeactivated,
provide,
reactive,
ref,
@ -69,6 +70,14 @@ export function useVbenModal<TParentModalProps extends ModalProps = ModalProps>(
inheritAttrs: false,
},
);
/**
* keepAlive /
*/
onDeactivated(() => {
(extendedApi as ExtendedModalApi)?.close?.();
});
return [Modal, extendedApi as ExtendedModalApi] as const;
}