mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-05 05:28:20 +08:00
49 lines
781 B
Markdown
49 lines
781 B
Markdown
|
---
|
||
|
order: 99
|
||
|
title:
|
||
|
zh-CN: Flex gap 样式
|
||
|
en-US: Flex gap style
|
||
|
debug: true
|
||
|
---
|
||
|
|
||
|
## zh-CN
|
||
|
|
||
|
Debug usage
|
||
|
|
||
|
## en-US
|
||
|
|
||
|
Debug usage
|
||
|
|
||
|
```tsx
|
||
|
import { Space, Switch } from 'antd';
|
||
|
|
||
|
const style: React.CSSProperties = {
|
||
|
width: 150,
|
||
|
height: 100,
|
||
|
background: 'red',
|
||
|
};
|
||
|
|
||
|
const Demo = () => {
|
||
|
const [singleCol, setSingleCol] = React.useState(false);
|
||
|
|
||
|
return (
|
||
|
<>
|
||
|
<Switch
|
||
|
checked={singleCol}
|
||
|
onChange={() => {
|
||
|
setSingleCol(!singleCol);
|
||
|
}}
|
||
|
/>
|
||
|
<Space style={{ width: singleCol ? 307 : 310, background: 'blue' }} size={[8, 8]} wrap>
|
||
|
<div style={style} />
|
||
|
<div style={style} />
|
||
|
<div style={style} />
|
||
|
<div style={style} />
|
||
|
</Space>
|
||
|
</>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
ReactDOM.render(<Demo />, mountNode);
|
||
|
```
|