From 2ffa793e849dd30ada38e2e697e1c3e19476f6ec Mon Sep 17 00:00:00 2001 From: szymon Date: Tue, 2 Jul 2024 07:53:42 +0200 Subject: [PATCH] fix modal --- src/components/MagicoModal.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/MagicoModal.vue b/src/components/MagicoModal.vue index 120c635..b554753 100644 --- a/src/components/MagicoModal.vue +++ b/src/components/MagicoModal.vue @@ -20,16 +20,16 @@ import { onMounted, onBeforeUnmount, ref, watch } from 'vue' export default { props: ['modelValue', 'title', 'class_other'], - emits: ['change','update:modelValue'], + emits: ['change','update:modelValue','hide'], setup(props, { emit }) { const id = 'modal' + Math.round(Math.random() * 100000) const modal = ref(null) const triggerModal = (value, emitEvent = true) => { if (value == true) { - modal.modelValue.show() + modal.value.show() } else { - modal.modelValue.hide() + modal.value.hide() if (emitEvent) { emit('hide') } @@ -39,7 +39,7 @@ export default { onMounted(() => { document.body.append(document.getElementById(id)) - modal.modelValue = new Modal(document.getElementById(id)) + modal.value = new Modal(document.getElementById(id)) document.getElementById(id).addEventListener('hidden.bs.modal', function () { triggerModal(false) }) @@ -47,7 +47,7 @@ export default { }) onBeforeUnmount(() => { - modal.modelValue.hide() + modal.value.hide() setTimeout(function () { document.getElementById(id).remove() }, 500)