mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 03:29:59 +08:00
commit
4e5c15bab7
@ -8,13 +8,13 @@
|
||||
|
||||
````jsx
|
||||
let Timeline = antd.Timeline;
|
||||
let container = document.getElementById('components-timeline-demo-end');
|
||||
let container = document.getElementById('components-timeline-demo-pending');
|
||||
|
||||
React.render(
|
||||
<Timeline>
|
||||
<Timeline pending={true}>
|
||||
<Timeline.Item>创建服务现场 2015-09-01</Timeline.Item>
|
||||
<Timeline.Item>初步排除网络异常 2015-09-01</Timeline.Item>
|
||||
<Timeline.Item end={true}>技术测试异常 2015-09-01</Timeline.Item>
|
||||
<Timeline.Item>技术测试异常 2015-09-01</Timeline.Item>
|
||||
</Timeline>
|
||||
, container);
|
||||
````
|
@ -12,7 +12,8 @@ let Timeline = React.createClass({
|
||||
<ul className={this.props.prefixCls}>
|
||||
{React.Children.map(children, function (ele, idx) {
|
||||
let np = {
|
||||
timelineLast: idx === children.length - 1
|
||||
timelineLast: idx === children.length - 1,
|
||||
pending: this.props.pending
|
||||
};
|
||||
return React.cloneElement(ele, np);
|
||||
}, this)}
|
||||
@ -26,21 +27,22 @@ Timeline.Item = React.createClass({
|
||||
return {
|
||||
prefixCls: 'ant-timeline',
|
||||
color: 'blue',
|
||||
end: false
|
||||
pending: false
|
||||
};
|
||||
},
|
||||
render() {
|
||||
let props = this.props;
|
||||
let prefixCls = props.prefixCls;
|
||||
let color = props.color;
|
||||
let end = props.end;
|
||||
let endCls = end ? prefixCls + '-item-last' : '';
|
||||
let last = end ? <div className={prefixCls + '-item-head ' + prefixCls + '-item-head-end'}></div> : null;
|
||||
let lastLineShow = (props.timelineLast && !end) ? 'none' : 'block';
|
||||
let pending = props.pending;
|
||||
let timelineLast = props.timelineLast;
|
||||
let endCls = pending && timelineLast ? prefixCls + '-item-last' : '';
|
||||
let last = pending && timelineLast ? <div className={prefixCls + '-item-head ' + prefixCls + '-item-head-end'}></div> : null;
|
||||
let lastTailShow = (timelineLast && !pending) ? 'none' : 'block';
|
||||
|
||||
return (
|
||||
<li className={prefixCls + '-item ' + endCls}>
|
||||
<div style={{display:lastLineShow}} className={prefixCls + '-item-tail'}></div>
|
||||
<div style={{display:lastTailShow}} className={prefixCls + '-item-tail'}></div>
|
||||
<div className={prefixCls + '-item-head ' + prefixCls + '-item-head-' + color}></div>
|
||||
<div className={prefixCls + '-item-content'}>{props.children}</div>
|
||||
{last}
|
||||
|
@ -24,6 +24,14 @@
|
||||
</Timeline>
|
||||
```
|
||||
|
||||
### Timeline
|
||||
|
||||
时间轴。
|
||||
|
||||
| 参数 | 说明 | 类型 | 可选值 |默认值 |
|
||||
|-----------|------------------------------------------|------------|-------|--------|
|
||||
| pending | 指定最后一个幽灵节点。 | boolean | 无 | false |
|
||||
|
||||
### Timeline.Item
|
||||
|
||||
时间轴的每一个节点。
|
||||
@ -31,4 +39,3 @@
|
||||
| 参数 | 说明 | 类型 | 可选值 |默认值 |
|
||||
|-----------|------------------------------------------|------------|-------|--------|
|
||||
| color | 指定圆圈颜色。 | string | blue, red, green | blue |
|
||||
| end | 指定最后一个幽灵节点。 | boolean | 无 | false |
|
||||
|
Loading…
Reference in New Issue
Block a user