Fix stuck no-scroll class on modal close

This commit is contained in:
Christian Cueni 2022-10-11 15:57:32 +02:00
parent d57c341d8c
commit 871c69c0a9
2 changed files with 13 additions and 3 deletions

View File

@ -62,7 +62,11 @@ const clickLink = (to: string) => {
<div class="mt-6 pb-6 border-b border-gray-500">
<ul>
<li>Shop</li>
<li class="mt-6">Mediathek</li>
<li class="mt-6">
<button @click="clickLink(`/media/versicherungsvermittlerin-media`)">
Mediathek
</button>
</li>
</ul>
</div>
<button

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
// inspiration https://vuejs.org/examples/#modal
import { onMounted, watch } from "vue";
import { onMounted, onUnmounted ,watch } from "vue";
const props = defineProps<{
show: boolean;
@ -20,11 +20,17 @@ onMounted(() => {
appElement = document.getElementById("app");
});
onUnmounted( () => removeNoScroll())
const closeModal = () => {
removeNoScroll();
emits("closemodal");
};
const removeNoScroll = () => {
if (appElement) {
appElement.classList.remove("no-scroll");
}
emits("closemodal");
};
</script>