mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 04:36:19 +08:00
51 lines
774 B
Markdown
51 lines
774 B
Markdown
|
---
|
||
|
order: 99
|
||
|
title:
|
||
|
zh-CN: 调试
|
||
|
en-US: Debug
|
||
|
only: true
|
||
|
---
|
||
|
|
||
|
## zh-CN
|
||
|
|
||
|
DEBUG
|
||
|
|
||
|
## en-US
|
||
|
|
||
|
DEBUG
|
||
|
|
||
|
```jsx
|
||
|
import { Affix, Button } from 'antd';
|
||
|
|
||
|
class Demo extends React.Component {
|
||
|
state = {
|
||
|
top: 10,
|
||
|
};
|
||
|
|
||
|
render() {
|
||
|
return (
|
||
|
<div style={{ height: 10000 }}>
|
||
|
<div>Top</div>
|
||
|
<Affix offsetTop={this.state.top}>
|
||
|
<div style={{ background: 'red' }}>
|
||
|
<Button
|
||
|
type="primary"
|
||
|
onClick={() => {
|
||
|
this.setState({
|
||
|
top: this.state.top + 10,
|
||
|
});
|
||
|
}}
|
||
|
>
|
||
|
Affix top
|
||
|
</Button>
|
||
|
</div>
|
||
|
</Affix>
|
||
|
<div>Bottom</div>
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
ReactDOM.render(<Demo />, mountNode);
|
||
|
```
|