mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-17 10:28:06 +08:00
3923288275
* refactor: RM rc-animate * put rc-animate back * clean up * chore: Update snasphot * feat: suport collapsible and deprecated disabled of Panel * docs: remove disabled of Panel * chore: bump rc-collapse to 3.1.0 * chore: update deprecated info * clean up * chore: update demo and remove rc-animate * chore: update snapshot Co-authored-by: Kermit <kermitlx@outlook.com>
52 lines
1.0 KiB
Markdown
52 lines
1.0 KiB
Markdown
---
|
|
order: 7
|
|
title:
|
|
zh-CN: 可折叠触发区域
|
|
en-US: Collapsible
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
通过 `collapsible` 属性,可以设置面板的可折叠触发区域。
|
|
|
|
## en-US
|
|
|
|
Specify the trigger area of collapsible by `collapsible`.
|
|
|
|
```jsx
|
|
import { Collapse, Space } from 'antd';
|
|
|
|
const { Panel } = Collapse;
|
|
|
|
const text = `
|
|
A dog is a type of domesticated animal.
|
|
Known for its loyalty and faithfulness,
|
|
it can be found as a welcome guest in many households across the world.
|
|
`;
|
|
|
|
ReactDOM.render(
|
|
<Space direction="vertical">
|
|
<Collapse collapsible="header" defaultActiveKey={['1']}>
|
|
<Panel header="This panel can only be collapsed by clicking text" key="1">
|
|
<p>{text}</p>
|
|
</Panel>
|
|
</Collapse>
|
|
<Collapse collapsible="disabled">
|
|
<Panel header="This panel can't be collapsed" key="1">
|
|
<p>{text}</p>
|
|
</Panel>
|
|
</Collapse>
|
|
</Space>,
|
|
mountNode,
|
|
);
|
|
```
|
|
|
|
<style>
|
|
[data-theme="compact"] p, p {
|
|
margin: 0;
|
|
}
|
|
#components-collapse-demo-collapsible .ant-space {
|
|
width: 100%;
|
|
}
|
|
</style>
|