mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-08-20 02:49:46 +08:00
17 lines
395 B
TypeScript
17 lines
395 B
TypeScript
import { inject, InjectionKey, watch } from 'vue';
|
|
|
|
// eslint-disable-next-line
|
|
export const POPUP_TOGGLE_KEY: InjectionKey<() => boolean> = Symbol();
|
|
|
|
export function onPopupReopen(callback: () => void) {
|
|
const popupToggleStatus = inject(POPUP_TOGGLE_KEY, null);
|
|
|
|
if (popupToggleStatus) {
|
|
watch(popupToggleStatus, (show) => {
|
|
if (show) {
|
|
callback();
|
|
}
|
|
});
|
|
}
|
|
}
|