mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-02 07:39:36 +08:00
4ec1b8ae09
* feat: Description list plus extra operation area * 修复title与extra对齐,加版本等问题 * 去掉basic里extra * 修改extra样式 * title与extra都没有的时候不展示header * 更新测试用例 Co-authored-by: chenshuai2144 <qixian.cs@outlook.com>
88 lines
2.4 KiB
Markdown
88 lines
2.4 KiB
Markdown
---
|
|
order: 2
|
|
title:
|
|
zh-CN: 自定义尺寸
|
|
en-US: Custom size
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
自定义尺寸,适应在各种容器中展示。
|
|
|
|
## en-US
|
|
|
|
Custom sizes to fit in a variety of containers.
|
|
|
|
```jsx
|
|
import { Descriptions, Radio, Button } from 'antd';
|
|
|
|
class Demo extends React.Component {
|
|
state = {
|
|
size: 'default',
|
|
};
|
|
|
|
onChange = e => {
|
|
console.log('size checked', e.target.value);
|
|
this.setState({
|
|
size: e.target.value,
|
|
});
|
|
};
|
|
|
|
render() {
|
|
return (
|
|
<div>
|
|
<Radio.Group onChange={this.onChange} value={this.state.size}>
|
|
<Radio value="default">default</Radio>
|
|
<Radio value="middle">middle</Radio>
|
|
<Radio value="small">small</Radio>
|
|
</Radio.Group>
|
|
<br />
|
|
<br />
|
|
<Descriptions
|
|
bordered
|
|
title="Custom Size"
|
|
size={this.state.size}
|
|
extra={<Button type="primary">Edit</Button>}
|
|
>
|
|
<Descriptions.Item label="Product">Cloud Database</Descriptions.Item>
|
|
<Descriptions.Item label="Billing">Prepaid</Descriptions.Item>
|
|
<Descriptions.Item label="time">18:00:00</Descriptions.Item>
|
|
<Descriptions.Item label="Amount">$80.00</Descriptions.Item>
|
|
<Descriptions.Item label="Discount">$20.00</Descriptions.Item>
|
|
<Descriptions.Item label="Official">$60.00</Descriptions.Item>
|
|
<Descriptions.Item label="Config Info">
|
|
Data disk type: MongoDB
|
|
<br />
|
|
Database version: 3.4
|
|
<br />
|
|
Package: dds.mongo.mid
|
|
<br />
|
|
Storage space: 10 GB
|
|
<br />
|
|
Replication factor: 3
|
|
<br />
|
|
Region: East China 1<br />
|
|
</Descriptions.Item>
|
|
</Descriptions>
|
|
<br />
|
|
<br />
|
|
<Descriptions
|
|
title="Custom Size"
|
|
size={this.state.size}
|
|
extra={<Button type="primary">Edit</Button>}
|
|
>
|
|
<Descriptions.Item label="Product">Cloud Database</Descriptions.Item>
|
|
<Descriptions.Item label="Billing">Prepaid</Descriptions.Item>
|
|
<Descriptions.Item label="time">18:00:00</Descriptions.Item>
|
|
<Descriptions.Item label="Amount">$80.00</Descriptions.Item>
|
|
<Descriptions.Item label="Discount">$20.00</Descriptions.Item>
|
|
<Descriptions.Item label="Official">$60.00</Descriptions.Item>
|
|
</Descriptions>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
ReactDOM.render(<Demo />, mountNode);
|
|
```
|