Commit 8f4d3d41 by LinaBell Committed by GitHub

fix: when keepAlive is enabled, returning directly through browser buttons/gestu…

…res will not close pop ups (#6113)
1 parent 3b3f8e4e
...@@ -9,6 +9,7 @@ import { ...@@ -9,6 +9,7 @@ import {
h, h,
inject, inject,
nextTick, nextTick,
onDeactivated,
provide, provide,
reactive, reactive,
ref, ref,
...@@ -70,6 +71,14 @@ export function useVbenDrawer< ...@@ -70,6 +71,14 @@ export function useVbenDrawer<
inheritAttrs: false, inheritAttrs: false,
}, },
); );
/**
* 在开启keepAlive情况下 直接通过浏览器按钮/手势等返回 不会关闭弹窗
*/
onDeactivated(() => {
(extendedApi as ExtendedDrawerApi)?.close?.();
});
return [Drawer, extendedApi as ExtendedDrawerApi] as const; return [Drawer, extendedApi as ExtendedDrawerApi] as const;
} }
......
...@@ -5,6 +5,7 @@ import { ...@@ -5,6 +5,7 @@ import {
h, h,
inject, inject,
nextTick, nextTick,
onDeactivated,
provide, provide,
reactive, reactive,
ref, ref,
...@@ -69,6 +70,14 @@ export function useVbenModal<TParentModalProps extends ModalProps = ModalProps>( ...@@ -69,6 +70,14 @@ export function useVbenModal<TParentModalProps extends ModalProps = ModalProps>(
inheritAttrs: false, inheritAttrs: false,
}, },
); );
/**
* 在开启keepAlive情况下 直接通过浏览器按钮/手势等返回 不会关闭弹窗
*/
onDeactivated(() => {
(extendedApi as ExtendedModalApi)?.close?.();
});
return [Modal, extendedApi as ExtendedModalApi] as const; return [Modal, extendedApi as ExtendedModalApi] as const;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!