Fix stuck no-scroll class on modal close
This commit is contained in:
parent
d57c341d8c
commit
871c69c0a9
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue