mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
fix form demo
This commit is contained in:
parent
ed4cc9e5fd
commit
e36e5aa5a2
@ -18,6 +18,8 @@ import { Form, Input, Icon, Button } from 'antd';
|
|||||||
|
|
||||||
const FormItem = Form.Item;
|
const FormItem = Form.Item;
|
||||||
|
|
||||||
|
let id = 0;
|
||||||
|
|
||||||
class DynamicFieldSet extends React.Component {
|
class DynamicFieldSet extends React.Component {
|
||||||
remove = (k) => {
|
remove = (k) => {
|
||||||
const { form } = this.props;
|
const { form } = this.props;
|
||||||
@ -37,8 +39,9 @@ class DynamicFieldSet extends React.Component {
|
|||||||
add = () => {
|
add = () => {
|
||||||
const { form } = this.props;
|
const { form } = this.props;
|
||||||
// can use data-binding to get
|
// can use data-binding to get
|
||||||
|
const myId = id++;
|
||||||
const keys = form.getFieldValue('keys');
|
const keys = form.getFieldValue('keys');
|
||||||
const nextKeys = keys.concat(keys.length);
|
const nextKeys = keys.concat(myId);
|
||||||
// can use data-binding to set
|
// can use data-binding to set
|
||||||
// important! notify form to detect changes
|
// important! notify form to detect changes
|
||||||
form.setFieldsValue({
|
form.setFieldsValue({
|
||||||
|
Loading…
Reference in New Issue
Block a user