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

Form.useForm may have errors in validate in nested forms

Open luocong2016 opened this issue 2 years ago • 1 comments

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

Version

3.3.0-beta.2

Environment

all

Reproduction link

https://antdv.com/components/form-cn#components-form-demo-useForm-nested

Steps to reproduce

  1. 案例同 https://antdv.com/components/form-cn#components-form-demo-useForm-nested
  2. validate使用参数['name', 'sub.name']

What is expected?

  1. 案例同 https://antdv.com/components/form-cn#components-form-demo-useForm-nested
  2. validate使用参数['name', 'sub.name']

What is actually happening?

与预期不同

{ name: 'fafd', sub.name: 'fsafdsadf' }
validate(['name', 'sub.name'])
        .then((res) => {
          console.log("form: ", res);
        })
        .catch((err) => {
          console.log("error", err);
        });

luocong2016 avatar Jul 15 '22 08:07 luocong2016

目前只能这样了

form.validate(fields).then((res) =>
      Object.keys(res).reduce((pre, k) => {
        _.set(pre, k, res[k]);
        return pre;
      }, {})
    );

luocong2016 avatar Jul 15 '22 09:07 luocong2016

This issue 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 Sep 14 '22 04:09 github-actions[bot]

This issue 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 Sep 22 '23 00:09 github-actions[bot]