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.
37 lines
601 B
37 lines
601 B
5 years ago
|
---
|
||
|
order: 10
|
||
|
title: useBreakpoint Hook
|
||
|
---
|
||
|
|
||
|
## zh-CN
|
||
|
|
||
|
使用 `useBreakpoint` Hook 个性化布局。
|
||
|
|
||
|
## en-US
|
||
|
|
||
|
Use `useBreakpoint` Hook povide personalized layout.
|
||
|
|
||
|
```jsx
|
||
|
import { Row, Col, Grid } from 'antd';
|
||
|
|
||
|
const { useBreakpoint } = Grid;
|
||
|
|
||
|
function UseBreakpointDemo() {
|
||
|
const screens = useBreakpoint();
|
||
|
|
||
|
return (
|
||
|
<Row>
|
||
|
<Col>
|
||
|
Current break point:
|
||
|
{Object.entries(screens)
|
||
|
.filter(screen => !!screen[1])
|
||
|
.map(screen => screen[0])
|
||
|
.join(' ')}
|
||
|
</Col>
|
||
|
</Row>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
ReactDOM.render(<UseBreakpointDemo />, mountNode);
|
||
|
```
|