ant-design-vue icon indicating copy to clipboard operation
ant-design-vue copied to clipboard

feat(form): Unify the data return format of failed and successful verification, and return the pure warning message of verification when verification is passed

Open qweasdzxcpkh opened this issue 2 years ago • 1 comments

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 ...

  • [x] 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?

在实际应用的时候,我有一个表单用了useForm,并且在某一个field的rule中用到了api去检查并返回校验信息。 某些校验信息是不需要阻止表单提交的,不过需要二次确认,我想在validate().then()中检查并弹窗给用户二次确认,但是我发现只能通过创建临时变量去保存需要二次确认的信息,并且需要在rule中维护这个临时变量,这样很不方便。查阅文档后我发现可以在rule中设置warningOnly达到不阻止表单提交的目的,但是我发现在校验通过的时候,并没有返回这些warning信息

What's the effect? (Optional if not new feature)

使用到 useForm 返回的 validate 方法的用户会受到影响

Changelog description (Optional if not new feature)

Self Check before Merge

  • [ ] Doc is updated/provided or not needed
  • [ ] Demo is updated/provided or not needed
  • [ ] TypeScript definition is updated/provided or not needed
  • [ ] Changelog is provided or not needed

Additional Plan? (Optional if not new feature)

sandbox 抛砖引玉

https://codesandbox.io/s/second-confirm-with-useform-r7e4yx

qweasdzxcpkh avatar Sep 04 '22 09:09 qweasdzxcpkh

这是个 break change,可以等大版本的时候看看要不要

tangjinzhou avatar Sep 13 '22 12:09 tangjinzhou

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[bot] avatar Nov 26 '22 02:11 github-actions[bot]

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[bot] avatar Dec 05 '23 00:12 github-actions[bot]