ant-design/components/affix/demo/debug.md

51 lines
775 B
Markdown
Raw Normal View History

2019-07-16 20:48:03 +08:00
---
order: 99
title:
zh-CN: 调试
en-US: Debug
2019-07-17 11:11:55 +08:00
debug: true
2019-07-16 20:48:03 +08:00
---
## 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);
```