refactor(frontend): refactor popup api and make sure call dispose callback

Close #14122
This commit is contained in:
syuilo
2024-07-04 13:14:49 +09:00
parent fab7d5e484
commit 6dd2e9fc0b
49 changed files with 317 additions and 196 deletions

View File

@@ -51,13 +51,15 @@ export default {
if (self.text == null) return;
const showing = ref(true);
popup(defineAsyncComponent(() => import('@/components/MkTooltip.vue')), {
const { dispose } = popup(defineAsyncComponent(() => import('@/components/MkTooltip.vue')), {
showing,
text: self.text,
asMfm: binding.modifiers.mfm,
direction: binding.modifiers.left ? 'left' : binding.modifiers.right ? 'right' : binding.modifiers.top ? 'top' : binding.modifiers.bottom ? 'bottom' : 'top',
targetElement: el,
}, {}, 'closed');
}, {
closed: () => dispose(),
});
self._close = () => {
showing.value = false;