2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 1
|
2016-09-01 11:48:38 +08:00
|
|
|
title:
|
2016-07-31 09:53:51 +08:00
|
|
|
zh-CN: 平行排列
|
|
|
|
en-US: Inline form
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-06-15 20:24:01 +08:00
|
|
|
|
2016-07-31 09:53:51 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2015-11-02 16:37:40 +08:00
|
|
|
行内排列,常用于登录界面。
|
|
|
|
|
2016-07-31 09:53:51 +08:00
|
|
|
## en-US
|
|
|
|
|
2016-09-01 11:48:38 +08:00
|
|
|
Inline form is often used for login.
|
2016-07-31 09:53:51 +08:00
|
|
|
|
2015-07-20 20:35:48 +08:00
|
|
|
````jsx
|
2016-01-23 15:22:16 +08:00
|
|
|
import { Form, Input, Button, Checkbox } from 'antd';
|
2015-10-29 08:41:51 +08:00
|
|
|
const FormItem = Form.Item;
|
2015-07-20 20:35:48 +08:00
|
|
|
|
2016-01-30 19:00:56 +08:00
|
|
|
let Demo = React.createClass({
|
2015-10-25 11:35:03 +08:00
|
|
|
handleSubmit(e) {
|
|
|
|
e.preventDefault();
|
2016-07-31 09:53:51 +08:00
|
|
|
console.log('Received values of form:', this.props.form.getFieldsValue());
|
2015-10-25 11:35:03 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
render() {
|
2016-09-01 11:48:38 +08:00
|
|
|
const { getFieldDecorator } = this.props.form;
|
2015-10-25 11:35:03 +08:00
|
|
|
return (
|
|
|
|
<Form inline onSubmit={this.handleSubmit}>
|
2015-10-29 08:41:51 +08:00
|
|
|
<FormItem
|
2016-07-31 09:53:51 +08:00
|
|
|
label="Account"
|
2016-06-06 13:54:10 +08:00
|
|
|
>
|
2016-09-01 11:48:38 +08:00
|
|
|
{getFieldDecorator('userName')(
|
|
|
|
<Input placeholder="Please input the account" />
|
|
|
|
)}
|
2015-10-29 08:41:51 +08:00
|
|
|
</FormItem>
|
|
|
|
<FormItem
|
2016-07-31 09:53:51 +08:00
|
|
|
label="Password"
|
2016-06-06 13:54:10 +08:00
|
|
|
>
|
2016-09-01 11:48:38 +08:00
|
|
|
{getFieldDecorator('password')(
|
|
|
|
<Input type="password" placeholder="Please input the password" />
|
|
|
|
)}
|
2015-10-29 08:41:51 +08:00
|
|
|
</FormItem>
|
|
|
|
<FormItem>
|
2016-09-01 11:48:38 +08:00
|
|
|
{getFieldDecorator('agreement')(
|
|
|
|
<Checkbox>Remember me</Checkbox>
|
|
|
|
)}
|
2015-10-29 08:41:51 +08:00
|
|
|
</FormItem>
|
2016-07-31 09:53:51 +08:00
|
|
|
<Button type="primary" htmlType="submit">Submit</Button>
|
2015-10-25 11:35:03 +08:00
|
|
|
</Form>
|
|
|
|
);
|
2016-05-11 09:32:33 +08:00
|
|
|
},
|
2015-10-25 11:35:03 +08:00
|
|
|
});
|
|
|
|
|
2016-01-30 19:00:56 +08:00
|
|
|
Demo = Form.create()(Demo);
|
|
|
|
|
2015-12-29 12:08:58 +08:00
|
|
|
ReactDOM.render(<Demo />, mountNode);
|
2015-06-15 20:24:01 +08:00
|
|
|
````
|