【Antd】如何在antd的Form组件中,将2个Input组件都放在同一个<Form.Item>标签中

import { Form, Input, Button } from 'antd';

class MyForm extends React.Component {
  handleSubmit = e => {
    e.preventDefault();
    this.props.form.validateFields((err, values) => {
      if (!err) {
        console.log('Form values:', values);
      }
    });
  }

  render() {
    const { getFieldDecorator } = this.props.form;

    return (
      <Form onSubmit={this.handleSubmit}>
        <Form.Item>
          <div style={{ display: 'flex' }}>
            <Form.Item name='aaa' style={{ marginRight: 8 }}>
                <Input placeholder="First Name" />,
            </Form.Item>

            <Form.Item name='bbb'>
                <Input placeholder="Last Name" />,
            </Form.Item>
          </div>
        </Form.Item>

        <Form.Item>
          <Button type="primary" htmlType="submit">Submit</Button>
        </Form.Item>
      </Form>
    );
  }
}

const WrappedForm = Form.create()(MyForm);

你可能感兴趣的:(javascript,前端,react.js)