mirror of
https://github.com/keven1024/015.git
synced 2026-05-26 07:08:02 +00:00
refactor(front): replace watch with watchEffect in FormButton component for improved reactivity
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user