ant-design/components/queue-anim/demo/basic.md

57 lines
1.2 KiB
Markdown
Raw Normal View History

2015-10-21 17:53:38 +08:00
# 进场和离场
- order: 1
2015-10-23 22:37:42 +08:00
同时支持进场和离场动画。
2015-10-21 17:53:38 +08:00
---
````jsx
import { QueueAnim, Button } from 'antd';
2015-10-21 17:53:38 +08:00
const Test = React.createClass({
2015-10-21 17:53:38 +08:00
getInitialState() {
return {
2015-10-23 22:37:42 +08:00
show: true
};
2015-10-21 17:53:38 +08:00
},
onClick() {
this.setState({
2015-10-23 22:37:42 +08:00
show: !this.state.show
});
2015-10-21 17:53:38 +08:00
},
render() {
return (
<div>
2015-10-23 22:37:42 +08:00
<p className="buttons">
2015-10-21 17:53:38 +08:00
<Button type="primary" onClick={this.onClick}>切换</Button>
2015-10-23 22:37:42 +08:00
</p>
2015-10-21 17:53:38 +08:00
<QueueAnim className="demo-content">
2015-10-23 22:37:42 +08:00
{this.state.show ? [
<div className="demo-kp" key="a">
<ul>
<li></li>
<li></li>
<li></li>
</ul>
</div>,
<div className="demo-listBox" key="b">
2015-10-21 17:53:38 +08:00
<div className="demo-list">
<div className="title"></div>
<ul>
<li></li>
<li></li>
<li></li>
</ul>
</div>
2015-10-23 22:37:42 +08:00
</div>
] : null}
2015-10-21 17:53:38 +08:00
</QueueAnim>
</div>
);
}
});
2015-10-23 22:37:42 +08:00
ReactDOM.render(<Test />, document.getElementById('components-queue-anim-demo-basic'));
2015-10-21 17:53:38 +08:00
````