|
|
|
@ -16,16 +16,46 @@ The simplest usage.
|
|
|
|
|
````jsx
|
|
|
|
|
import { Affix, Button } from 'antd';
|
|
|
|
|
|
|
|
|
|
class Demo extends React.Component {
|
|
|
|
|
state = {
|
|
|
|
|
top: 10,
|
|
|
|
|
bottom: 10,
|
|
|
|
|
}
|
|
|
|
|
render() {
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<Affix offsetTop={this.state.top}>
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
this.setState({
|
|
|
|
|
top: this.state.top + 10,
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Affix top
|
|
|
|
|
</Button>
|
|
|
|
|
</Affix>
|
|
|
|
|
<br />
|
|
|
|
|
<Affix offsetBottom={this.state.bottom}>
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
this.setState({
|
|
|
|
|
bottom: this.state.bottom + 10,
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Affix bottom
|
|
|
|
|
</Button>
|
|
|
|
|
</Affix>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
|
<div>
|
|
|
|
|
<Affix>
|
|
|
|
|
<Button type="primary">Affix top</Button>
|
|
|
|
|
</Affix>
|
|
|
|
|
<br />
|
|
|
|
|
<Affix offsetBottom={0}>
|
|
|
|
|
<Button type="primary">Affix bottom</Button>
|
|
|
|
|
</Affix>
|
|
|
|
|
</div>,
|
|
|
|
|
<Demo />,
|
|
|
|
|
mountNode
|
|
|
|
|
);
|
|
|
|
|
````
|
|
|
|
|