0.0.1 • Published 5 years ago

abc-timeline v0.0.1

Weekly downloads
3
License
-
Repository
-
Last release
5 years ago

时间线组件

提供时间线数据展示,支持自定义时间节点

适用范围

适合需要按照时间先后顺序展示数据的场景

代码演示

<TimeLine
    data={MOCK_DATA.data}
    limit={5}
    onClickItem={(data) => {}}
    timeItem={(props) => {
        let {data = {}} = props;
        let url = data.url;
        return (
            <div className={"analyzer-timeline"}>
                <p className={"timeline-title"}>
                    <a href={url} target="_blank" title={data.title || "--"} >{data.title || "--"}</a>
                </p>
                <p className={"timeline-bottom"}>
                    <Icon className={"timeline-bottom-icon"} 
                        type={data.type === 'wechat' ? 'wechat' : 'profile'}/>
                    <span className={"abc-timeline-bottom-text"}>{data.source || "--"}</span>
                    <span className={"abc-timeline-bottom-text"}>{data.time ? moment(data.time).format("YYYY/MM/DD") : "--"}</span>
                </p>
            </div>
        )
    }} />

API

参数说明类型默认值
data时间线数据array--
limit限制展示的节点数number--
onClickItem点击节点事件function--
timeItem自定义时间节点element--