This commit is contained in:
parent
c73ec73920
commit
1294f5f06f
|
@ -4,8 +4,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<MkModal ref="modal" v-slot="{ type, maxHeight }" :manualShowing="manualShowing" :zPriority="'high'" :src="src" :transparentBg="true" @click="click" @close="onModalClose" @closed="closed">
|
<MkModal ref="modal" v-slot="{ type, maxHeight }" :manualShowing="manualShowing" :zPriority="'high'" :src="src" :transparentBg="true" @click="click" @close="onModalClose" @closed="onModalClosed">
|
||||||
<MkMenu :items="items" :align="align" :width="width" :max-height="maxHeight" :asDrawer="type === 'drawer'" :class="{ [$style.drawer]: type === 'drawer' }" @close="onMenuClose" @hide="manualShowing = false"/>
|
<MkMenu :items="items" :align="align" :width="width" :max-height="maxHeight" :asDrawer="type === 'drawer'" :class="{ [$style.drawer]: type === 'drawer' }" @close="onMenuClose" @hide="hide"/>
|
||||||
</MkModal>
|
</MkModal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ const emit = defineEmits<{
|
||||||
|
|
||||||
let modal = $shallowRef<InstanceType<typeof MkModal>>();
|
let modal = $shallowRef<InstanceType<typeof MkModal>>();
|
||||||
const manualShowing = ref(true);
|
const manualShowing = ref(true);
|
||||||
|
const hiding = ref(false);
|
||||||
|
|
||||||
function click() {
|
function click() {
|
||||||
close();
|
close();
|
||||||
|
@ -41,22 +42,22 @@ function onModalClose() {
|
||||||
|
|
||||||
function onMenuClose() {
|
function onMenuClose() {
|
||||||
close();
|
close();
|
||||||
if (manualShowing.value === false) {
|
|
||||||
// 先にhideが来ていたらclosedを発火
|
|
||||||
emit('closed');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function closed() {
|
function onModalClosed() {
|
||||||
if (manualShowing.value === true) {
|
if (!hiding.value) {
|
||||||
// hideが来ていない場合のみclosedを発火
|
// hideが来ていない場合のみclosedを発火
|
||||||
emit('closed');
|
emit('closed');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hide() {
|
||||||
|
manualShowing.value = false;
|
||||||
|
hiding.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
if (!modal) return;
|
manualShowing.value = false;
|
||||||
modal.close();
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue