feat: add onPopupReopen (#8641)

This commit is contained in:
neverland
2021-05-01 16:40:50 +08:00
committed by GitHub
parent 161b5980eb
commit b43822562f
2 changed files with 23 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
import { inject, watch } from 'vue';
// eslint-disable-next-line
export const POPUP_TOGGLE_KEY = Symbol();
export function onPopupReopen(callback: () => void) {
const popupToggleStatus = inject<(() => boolean) | null>(
POPUP_TOGGLE_KEY,
null
);
if (popupToggleStatus) {
watch(popupToggleStatus, (show) => {
if (show) {
callback();
}
});
}
}