Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/components/Modal.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<portal to="modals">
<div v-if="showModal" class="fixed inset-0 flex items-center justify-center">
<div v-if="showModal" class="fixed inset-0">
<transition
@before-leave="backdropLeaving = true"
@after-leave="backdropLeaving = false"
Expand All @@ -13,7 +13,7 @@
appear
>
<div v-if="showBackdrop">
<div class="absolute inset-0 bg-black opacity-25" @click="close"></div>
<div class="fixed inset-0 bg-black opacity-25"></div>
</div>
</transition>

Expand All @@ -28,8 +28,11 @@
leave-to-class="opacity-0 scale-70"
appear
>
<div v-if="showContent" class="relative">
<slot></slot>
<div v-if="showContent" class="relative h-full overflow-y-auto text-center" @click="close">
<div class="inline-block align-middle w-0 h-screen"></div>
<div class="inline-block align-middle text-left my-6" @click.stop>
<slot></slot>
</div>
</div>
</transition>
</div>
Expand Down Expand Up @@ -89,10 +92,12 @@ export default {
this.showModal = true
this.showBackdrop = true
this.showContent = true
document.body.style.setProperty('overflow', 'hidden')
},
close() {
this.showBackdrop = false
this.showContent = false
document.body.style.removeProperty('overflow')
}
}
}
Expand Down