From 6191bcc04f5b3e0aa2a04c6dcbf24af35b7e4daa Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Tue, 2 Jan 2024 04:11:34 +0100 Subject: [PATCH] made sure to utilise the defineModal makro instead of defining this myself --- .../src/components/DetailsImageSlideshowModal.vue | 2 +- webclient/src/components/DetailsRoomfinderMap.vue | 2 +- webclient/src/components/Modal.vue | 10 +++++----- webclient/src/components/PreferencesPopup.vue | 4 ++-- webclient/src/components/SelectionSwitch.vue | 9 ++++----- webclient/src/components/ShareButton.vue | 2 +- webclient/src/components/TinyModal.vue | 2 +- webclient/src/components/feedback/TokenBasedModal.vue | 4 ++-- 8 files changed, 17 insertions(+), 18 deletions(-) diff --git a/webclient/src/components/DetailsImageSlideshowModal.vue b/webclient/src/components/DetailsImageSlideshowModal.vue index e23328c40..670b2925e 100644 --- a/webclient/src/components/DetailsImageSlideshowModal.vue +++ b/webclient/src/components/DetailsImageSlideshowModal.vue @@ -10,7 +10,7 @@ const appURL = import.meta.env.VITE_APP_URL; diff --git a/webclient/src/components/Modal.vue b/webclient/src/components/Modal.vue index fd2fb02b2..783cd86d9 100644 --- a/webclient/src/components/Modal.vue +++ b/webclient/src/components/Modal.vue @@ -5,7 +5,6 @@ import { useI18n } from "vue-i18n"; export interface Props { title: string; - open: boolean; disableClose?: boolean; classes?: { background?: string; @@ -21,11 +20,12 @@ const props = withDefaults(defineProps(), { modal: "", }), }); -const emit = defineEmits(["close", "update:open"]); +const emit = defineEmits(["close"]); +const isOpen = defineModel({ required: true }); const { t } = useI18n({ useScope: "local" }); watch(props, () => { - if (props.open) { + if (isOpen) { return document.querySelector("body")?.classList.add("overflow-hidden"); } else { return document.querySelector("body")?.classList.remove("overflow-hidden"); @@ -45,7 +45,7 @@ onBeforeUnmount(() => document.querySelector("body")?.classList.remove("overflow function close() { document.querySelector("body")?.classList.remove("overflow-hidden"); emit("close"); - emit("update:open", false); + isOpen.value = false; } function closeIfShown() { @@ -63,7 +63,7 @@ function closeIfShown() { leave-active-class="transition duration-75" >
- + - + diff --git a/webclient/src/components/SelectionSwitch.vue b/webclient/src/components/SelectionSwitch.vue index 5adb876e0..3e1b09cfc 100644 --- a/webclient/src/components/SelectionSwitch.vue +++ b/webclient/src/components/SelectionSwitch.vue @@ -4,13 +4,12 @@ import { computed } from "vue"; interface Props { label?: string; - selected: string; values: [string, string]; } - const props = withDefaults(defineProps(), { label: "" }); -const emit = defineEmits(["update:selected"]); -const firstValueSelected = computed(() => props.selected === props.values[0]); +const selected = defineModel({ required: true }); + +const firstValueSelected = computed(() => selected.value === props.values[0]);