Browse Source
fix: when keepAlive is enabled, returning directly through browser buttons/gestures will not close pop ups (#6113)
pull/6117/head
LinaBell
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
18 additions and
0 deletions
-
packages/@core/ui-kit/popup-ui/src/drawer/use-drawer.ts
-
packages/@core/ui-kit/popup-ui/src/modal/use-modal.ts
|
|
|
@ -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; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -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; |
|
|
|
} |
|
|
|
|
|
|
|
|