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

79 lines
2.2 KiB
Markdown
Raw Normal View History

2015-10-23 22:37:42 +08:00
# 一个复杂些的例子
2015-10-21 17:53:38 +08:00
- order: 6
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>
<QueueAnim type={['right', 'left']}>
{this.state.show ? [
<div className="demo-header" key="header">
<div className="logo">
<img width="30" src="https://t.alipayobjects.com/images/rmsweb/T1B9hfXcdvXXXXXXXX.svg" />
<span>logo</span>
</div>
2015-10-23 22:37:42 +08:00
<QueueAnim component="ul">
<li key="0"></li>
<li key="1"></li>
<li key="2"></li>
<li key="3"></li>
<li key="4"></li>
2015-10-23 22:37:42 +08:00
</QueueAnim>
</div>,
<QueueAnim className="demo-content" key="content" delay={300}>
<div className="demo-title" key="title">我是标题</div>
<div className="demo-kp" key="b">
<QueueAnim component="ul">
2015-10-23 22:37:42 +08:00
<li key="0"></li>
<li key="1"></li>
<li key="2"></li>
</QueueAnim>
</div>
<div className="demo-title" key="title2">我是标题</div>
<div className="demo-listBox">
<QueueAnim className="demo-list" delay={500}>
<div className="title" key="title3"></div>
<QueueAnim component="ul" type="bottom" key="li">
<li key="0"></li>
<li key="1"></li>
<li key="2"></li>
<li key="3"></li>
<li key="4"></li>
</QueueAnim>
</QueueAnim>
</div>
</QueueAnim>,
<QueueAnim delay={1000} type="bottom" key="footerBox">
<div className="demo-footer" key="footer"></div>
</QueueAnim>
2015-10-23 22:37:42 +08:00
] : null}
</QueueAnim>
2015-10-21 17:53:38 +08:00
</div>
);
}
});
ReactDOM.render(<Test />, mountNode);
2015-10-21 17:53:38 +08:00
````