2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 10
|
|
|
|
title: 高级搜索
|
|
|
|
---
|
2015-12-29 23:39:21 +08:00
|
|
|
|
|
|
|
三列栅格式的表单排列方式,常用于数据表格的高级搜索。
|
|
|
|
|
|
|
|
有部分定制的样式代码,由于输入标签长度不确定,需要根据具体情况自行调整。
|
|
|
|
|
|
|
|
````jsx
|
2016-04-12 14:55:02 +08:00
|
|
|
import { Form, Input, Row, Col, Button, DatePicker } from 'antd';
|
2015-12-29 23:39:21 +08:00
|
|
|
const FormItem = Form.Item;
|
|
|
|
|
|
|
|
ReactDOM.render(
|
2016-04-29 12:13:27 +08:00
|
|
|
<Form horizontal className="ant-advanced-search-form">
|
|
|
|
<Row gutter={16}>
|
|
|
|
<Col sm={8}>
|
|
|
|
<FormItem
|
2016-06-02 18:09:20 +08:00
|
|
|
label="搜索名称"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
|
|
|
wrapperCol={{ span: 14 }}>
|
2016-05-19 15:21:48 +08:00
|
|
|
<Input placeholder="请输入搜索名称" size="default" />
|
2016-04-29 12:13:27 +08:00
|
|
|
</FormItem>
|
|
|
|
<FormItem
|
2016-06-02 18:09:20 +08:00
|
|
|
label="较长搜索名称"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
|
|
|
wrapperCol={{ span: 14 }}>
|
|
|
|
<DatePicker size="default" />
|
|
|
|
</FormItem>
|
|
|
|
<FormItem
|
2016-06-02 18:09:20 +08:00
|
|
|
label="搜索名称"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
|
|
|
wrapperCol={{ span: 14 }}>
|
2016-05-19 15:21:48 +08:00
|
|
|
<Input placeholder="请输入搜索名称" size="default" />
|
2016-04-29 12:13:27 +08:00
|
|
|
</FormItem>
|
|
|
|
</Col>
|
|
|
|
<Col sm={8}>
|
|
|
|
<FormItem
|
2016-06-02 18:09:20 +08:00
|
|
|
label="搜索名称"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
|
|
|
wrapperCol={{ span: 14 }}>
|
2016-05-19 15:21:48 +08:00
|
|
|
<Input placeholder="请输入搜索名称" size="default" />
|
2016-04-29 12:13:27 +08:00
|
|
|
</FormItem>
|
|
|
|
<FormItem
|
2016-06-02 18:09:20 +08:00
|
|
|
label="较长搜索名称"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
|
|
|
wrapperCol={{ span: 14 }}>
|
|
|
|
<DatePicker size="default" />
|
|
|
|
</FormItem>
|
|
|
|
<FormItem
|
2016-06-02 18:09:20 +08:00
|
|
|
label="搜索名称"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
|
|
|
wrapperCol={{ span: 14 }}>
|
2016-05-19 15:21:48 +08:00
|
|
|
<Input placeholder="请输入搜索名称" size="default" />
|
2016-04-29 12:13:27 +08:00
|
|
|
</FormItem>
|
|
|
|
</Col>
|
|
|
|
<Col sm={8}>
|
|
|
|
<FormItem
|
2016-06-02 18:09:20 +08:00
|
|
|
label="搜索名称"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
|
|
|
wrapperCol={{ span: 14 }}>
|
2016-05-19 15:21:48 +08:00
|
|
|
<Input placeholder="请输入搜索名称" size="default" />
|
2016-04-29 12:13:27 +08:00
|
|
|
</FormItem>
|
|
|
|
<FormItem
|
2016-06-02 18:09:20 +08:00
|
|
|
label="较长搜索名称"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
|
|
|
wrapperCol={{ span: 14 }}>
|
|
|
|
<DatePicker size="default" />
|
|
|
|
</FormItem>
|
|
|
|
<FormItem
|
2016-06-02 18:09:20 +08:00
|
|
|
label="搜索名称"
|
2016-04-29 12:13:27 +08:00
|
|
|
labelCol={{ span: 10 }}
|
|
|
|
wrapperCol={{ span: 14 }}>
|
2016-05-19 15:21:48 +08:00
|
|
|
<Input placeholder="请输入搜索名称" size="default" />
|
2016-04-29 12:13:27 +08:00
|
|
|
</FormItem>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
|
|
|
<Col span={12} offset={12} style={{ textAlign: 'right' }}>
|
|
|
|
<Button type="primary" htmlType="submit">搜索</Button>
|
|
|
|
<Button>清除条件</Button>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
</Form>
|
2015-12-29 23:39:21 +08:00
|
|
|
, mountNode);
|
|
|
|
````
|
|
|
|
|
|
|
|
````css
|
|
|
|
/* 定制样式 */
|
|
|
|
|
2016-04-06 12:08:40 +08:00
|
|
|
.ant-advanced-search-form {
|
2015-12-29 23:39:21 +08:00
|
|
|
padding: 16px 8px;
|
2015-12-29 23:43:10 +08:00
|
|
|
background: #f8f8f8;
|
2015-12-29 23:39:21 +08:00
|
|
|
border: 1px solid #d9d9d9;
|
|
|
|
border-radius: 6px;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 由于输入标签长度不确定,所以需要微调使之看上去居中 */
|
2016-06-06 11:40:54 +08:00
|
|
|
.ant-advanced-search-form > .ant-row {
|
2016-02-25 18:03:48 +08:00
|
|
|
position: relative;
|
|
|
|
left: -6px;
|
2015-12-29 23:39:21 +08:00
|
|
|
}
|
|
|
|
|
2016-04-06 12:08:40 +08:00
|
|
|
.ant-advanced-search-form .ant-btn + .ant-btn {
|
2015-12-29 23:39:21 +08:00
|
|
|
margin-left: 8px;
|
|
|
|
}
|
|
|
|
````
|
|
|
|
|
|
|
|
<style>
|
2015-12-29 23:43:10 +08:00
|
|
|
#components-form-demo-advanced-search-form .ant-form-horizontal {
|
2015-12-29 23:39:21 +08:00
|
|
|
max-width: none;
|
|
|
|
}
|
|
|
|
</style>
|