-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(form): formList support function children (#3635)
- Loading branch information
1 parent
d89667e
commit 93fb20d
Showing
5 changed files
with
649 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from 'react'; | ||
import ProForm, { ProFormList, ProFormText, ProFormDependency } from '@ant-design/pro-form'; | ||
|
||
const Demo = () => { | ||
return ( | ||
<ProForm> | ||
<ProFormList | ||
name={['default', 'users']} | ||
label="用户信息" | ||
initialValue={[ | ||
{ | ||
name: '1111', | ||
}, | ||
]} | ||
itemContainerRender={(doms) => { | ||
return <ProForm.Group>{doms}</ProForm.Group>; | ||
}} | ||
> | ||
{(filed, index) => { | ||
return <ProFormText initialValue={index} name="rowKey" label={`第 ${index} 配置`} />; | ||
}} | ||
<ProFormText name="name" label="姓名" /> | ||
<ProFormDependency name={['name']}> | ||
{({ name }) => { | ||
if (!name) { | ||
return null; | ||
} | ||
return <ProFormText name="remark" label="昵称详情" />; | ||
}} | ||
</ProFormDependency> | ||
</ProFormList> | ||
</ProForm> | ||
); | ||
}; | ||
|
||
export default Demo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.