2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 2
|
|
|
|
title: 进场和离场
|
|
|
|
---
|
2015-10-21 17:53:38 +08:00
|
|
|
|
2015-10-23 22:37:42 +08:00
|
|
|
通过把属性设置一个数组来分别表示进出场的效果,`type`、`animConfig`、`delay`、`duration`、`interval`、`ease` 等属性均支持配置为数组。
|
2015-10-21 17:53:38 +08:00
|
|
|
|
|
|
|
````jsx
|
2015-10-28 20:55:49 +08:00
|
|
|
import { QueueAnim, Button } from 'antd';
|
2015-10-21 17:53:38 +08:00
|
|
|
|
2015-10-28 20:55:49 +08:00
|
|
|
const Test = React.createClass({
|
2015-10-21 17:56:42 +08:00
|
|
|
getInitialState() {
|
|
|
|
return {
|
2015-10-23 22:37:42 +08:00
|
|
|
show: true
|
|
|
|
};
|
2015-10-21 17:56:42 +08:00
|
|
|
},
|
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() {
|
2016-04-13 15:00:47 +08:00
|
|
|
const list = this.state.show ? [
|
|
|
|
<div className="demo-kp" key="a">
|
|
|
|
<ul>
|
|
|
|
<li></li>
|
|
|
|
<li></li>
|
|
|
|
<li></li>
|
|
|
|
</ul>
|
|
|
|
</div>,
|
|
|
|
<div className="demo-listBox" key="b">
|
|
|
|
<div className="demo-list">
|
2016-04-29 12:13:27 +08:00
|
|
|
<div className="title"></div>
|
2016-04-13 15:00:47 +08:00
|
|
|
<ul>
|
|
|
|
<li></li>
|
|
|
|
<li></li>
|
|
|
|
<li></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
] : null;
|
2015-10-21 17:53:38 +08:00
|
|
|
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 className="demo-content"
|
|
|
|
key="demo"
|
|
|
|
type={['right', 'left']}
|
|
|
|
ease={['easeOutQuart', 'easeInOutQuart']}>
|
2016-04-13 15:00:47 +08:00
|
|
|
{list}
|
2015-10-21 17:53:38 +08:00
|
|
|
</QueueAnim>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-12-29 12:08:58 +08:00
|
|
|
ReactDOM.render(<Test />, mountNode);
|
2015-10-21 17:53:38 +08:00
|
|
|
````
|