Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promise state of formRef.value.validate() is always rejected, errorFields is 0, and outOfDate is true when using form component during form validation #7852

Open
1 task
wangshilin123 opened this issue Sep 22, 2024 · 0 comments

Comments

@wangshilin123
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

4.2.5

Environment

win11,Chrome128.0.6613.138,vue@3.5.6

Reproduction link

Edit on CodeSandbox

Steps to reproduce

<a-form
ref="formRef"
:model="formState"
:rules="formRules"
@submit.prevent="handleSubmit"
class="login-form"

forget-password
登录

import { reactive, ref } from 'vue'
const formRef = ref()
const formRules = {
username: [{ required: true, message: 'username', trigger: 'blur' }],
password: [{ required: true, message: 'password', trigger: 'blur' }],
}

const handleSubmit = async () => {
try {
await formRef.value.validate()
....}
catch (errors) {
console.error(errors)
}
}

What is expected?

It should be "fulfilled" in the promise state to proceed with the next code execution.

What is actually happening?

The promise state of formRef.value.validate() is always rejected, consistently caught by catch, causing the program to exit due to the error.


When I changed the component from a-form to Naive UI's n-form, the promise state was fulfilled, so I suspect it's a bug. Since I'm new to learning Vue, I don't know how to resolve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant