You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.1 KiB

9 years ago
# 平行排列
10 years ago
10 years ago
- order: 1
10 years ago
9 years ago
行内排列,常用于登录界面。
10 years ago
---
````jsx
import { Form, Input, Button, Checkbox } from 'antd';
const FormItem = Form.Item;
9 years ago
let Demo = React.createClass({
handleSubmit(e) {
e.preventDefault();
9 years ago
console.log('收到表单值:', this.props.form.getFieldsValue());
},
render() {
9 years ago
const { getFieldProps } = this.props.form;
return (
<Form inline onSubmit={this.handleSubmit}>
<FormItem
label="账户:">
9 years ago
<Input placeholder="请输入账户名"
{...getFieldProps('userName')} />
</FormItem>
<FormItem
label="密码:">
9 years ago
<Input type="password" placeholder="请输入密码"
{...getFieldProps('password')} />
</FormItem>
<FormItem>
<label className="ant-checkbox-inline">
9 years ago
<Checkbox
{...getFieldProps('agreement')} />记住我
</label>
</FormItem>
<Button type="primary" htmlType="submit">登录</Button>
</Form>
);
}
});
9 years ago
Demo = Form.create()(Demo);
ReactDOM.render(<Demo />, mountNode);
10 years ago
````