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

[QUESTION]如何实现联动校验 #348

Open
xmsz-stu opened this issue Jul 8, 2024 · 1 comment
Open

[QUESTION]如何实现联动校验 #348

xmsz-stu opened this issue Jul 8, 2024 · 1 comment

Comments

@xmsz-stu
Copy link

xmsz-stu commented Jul 8, 2024

本来想用[source](validator: (rule, value, cb, source) 的source,但是发现source并不完整
希望可以拿到其他field的值,然后联动配合校验

比如, type === 'date' 要联动校验 date的值

@reaway
Copy link

reaway commented Sep 8, 2024

这个我也遇到了,我发现是element plus的原因:
https://github.com/element-plus/element-plus/blob/dev/packages/components/form/src/form-item.vue
第290行:.validate({ [modelName]: fieldValue.value }, { firstFields: true })
改成 .validate(formContext?.model ?? {}, { firstFields: true })
可以搞定,大概是element-plus没有把全部源数据传给async-validator

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

2 participants