From a78eb2efa3a34c7b29bf6c9463e1cf0a4a2b09c6 Mon Sep 17 00:00:00 2001 From: keven1024 <99848979+keven1024@users.noreply.github.com> Date: Mon, 5 May 2025 20:56:55 +0800 Subject: [PATCH] refactor(front): replace watch with watchEffect in FormButton component for improved reactivity --- front/components/Field/FormButton.vue | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/front/components/Field/FormButton.vue b/front/components/Field/FormButton.vue index 7b2bba3..ee764bb 100644 --- a/front/components/Field/FormButton.vue +++ b/front/components/Field/FormButton.vue @@ -12,14 +12,11 @@ import { useFormContext } from 'vee-validate' const form = useFormContext() const isValid = ref(false) -watch( - () => form?.values, - async () => { - const { valid } = await form?.validate() - isValid.value = valid - }, - { deep: true } -) + +watchEffect(async () => { + const { valid } = await form?.validate() + isValid.value = valid +}) const emit = defineEmits<{ (e: 'click', form: ReturnType): void