Skip to content

feature: to #401 支持下直接设置namePath和value - #402

Open
AM-young-fun wants to merge 1 commit into
react-component:masterfrom
AM-young-fun:master
Open

feature: to #401 支持下直接设置namePath和value#402
AM-young-fun wants to merge 1 commit into
react-component:masterfrom
AM-young-fun:master

Conversation

@AM-young-fun

Copy link
Copy Markdown

No description provided.

@vercel

vercel Bot commented Apr 5, 2022

Copy link
Copy Markdown

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/react-component/field-form/6y2LdBrcpMjMnMoCxUNuM5cJHmEE
✅ Preview: https://field-form-git-fork-antimoron-master-react-component.vercel.app

@crazyair

crazyair commented Apr 5, 2022

Copy link
Copy Markdown
Contributor

现有能满足就不增加 API 了,到时候只会是负累,可以自己封装 Form,对于需要使用的语法糖,自己隋意添加。

form.setFields(
    [
        [[field.name, 'userName'], 'XiaoMing'],
        [[field.name, 'gender'], 'Male'],
    ].map(item => ({ name: item[0], value: item[1] }))
);

@pisyell

pisyell commented Jun 10, 2022

Copy link
Copy Markdown

为什么没有 setFieldValue(namepath, value) ?
这样的写法会导致validate error无法自动更新

@crazyair

Copy link
Copy Markdown
Contributor

setFieldsValue 包含了设置 error, setFields 需要自己设置 error

form.setFields(
    [
        [[field.name, 'userName'], 'XiaoMing'],
        [[field.name, 'gender'], 'Male'],
    ].map(item => ({ name: item[0], value: item[1],error:[] }))
);

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

Successfully merging this pull request may close these issues.

3 participants