refactor(front): replace watch with watchEffect in FormButton component for improved reactivity

This commit is contained in:
keven1024
2025-05-05 20:56:55 +08:00
parent 500d78e428
commit a78eb2efa3

View File

@@ -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<typeof useFormContext>): void