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

feat(useForm): add ignoreMissedProps option #4647

Closed
wants to merge 1 commit into from
Closed

feat(useForm): add ignoreMissedProps option #4647

wants to merge 1 commit into from

Conversation

ylc395
Copy link
Contributor

@ylc395 ylc395 commented Sep 12, 2021

First of all, thank you for your contribution! 😄

New feature please send pull request to feature branch, and rest to master branch. Pull request will be merged after one of collaborators approve. Please makes sure that these form are filled before submitting your pull request, thank you!

[中文版模板 / Chinese template]

This is a ...

  • New feature
  • [] Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Branch merge
  • Other (about what?)

What's the background?

提供一个“是否忽略不存在的属性”选项(默认为是)。当为否,将校验这个不存在的属性(值为undefined),以确保validateInfos上,相应属性的validateStatus有值。一般搭配 {immediate: true}使用。

具体场景是:用户可在初次校验时获得完整的校验结果(包含缺失的属性)

@ylc395
Copy link
Contributor Author

ylc395 commented Sep 26, 2021

throw new Error('please transfer a valid name path to validate!');

在业务场景中我有另一个感想:这个异常抛出其实就不该存在。不应该假定用户传的 model 和 rules 是能对得上的。合理的做法是对于不存在的路径,一律按值为 undefined 进行校验(该报 required 就报 required 这样)

我们可以在这个 PR 里一并讨论下“校验不存在的路径”的相关问题。

@github-actions
Copy link

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label Nov 26, 2021
@github-actions github-actions bot closed this Dec 3, 2021
@github-actions
Copy link

github-actions bot commented Dec 4, 2022

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants