diff --git a/components/calcValues.vue b/components/calcValues.vue index 7e2a7df..a2306ee 100644 --- a/components/calcValues.vue +++ b/components/calcValues.vue @@ -136,11 +136,6 @@ watch(() => form_state, changeParametres, { deep: true }) const isModalOpen = useState('modal_open', () => false) const toggleModal = () => { isModalOpen.value = !isModalOpen.value - if (isModalOpen.value == true) { - document.body.classList.add('modal-opened') - } else { - document.body.classList.remove('modal-opened') - } } const goal = (target: string, params: object) => { const nuxtApp = useNuxtApp() diff --git a/components/modal.vue b/components/modal.vue index c362e87..b1da015 100644 --- a/components/modal.vue +++ b/components/modal.vue @@ -75,6 +75,13 @@ const validate = () => { } } watch(modal_data, validate) +watch(isModalOpen, () => { + if (isModalOpen.value == true) { + document.body.classList.add('modal-opened') + } else { + document.body.classList.remove('modal-opened') + } +}) const submit = async (e: any) => { goal('submit_form', modal_data) @@ -216,8 +223,9 @@ const policy = () => { @keypress="validateInput" />