FxTimeline 时间线
可视化地呈现时间流信息。不依赖任何 UI 框架,颜色走 @fx/styles 的 --color-* token。
轴线与默认节点为 --color-border-light(灰),仅当传 type 时节点变为语义色。
基础用法
Timeline 可拆分为多个活动节点,时间戳是其区别于其他组件的重要特性。
模式 mode
使用 mode 控制时间线与内容的相对位置。
自定义节点
节点的尺寸、颜色、图标均可自定义。
自定义时间戳
内容较高时,可将时间戳置于内容上方(placement="top")。
垂直居中
center 让节点垂直居中。
倒序 reverse
使用 reverse 控制节点排列顺序。
API
FxTimeline Attributes
| 属性 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| mode | 时间线与内容的相对位置 | 'start' | 'end' | 'alternate' | 'alternate-reverse' | start |
| reverse | 是否倒序渲染 | boolean | false |
FxTimeline Slots
| 插槽名 | 说明 |
|---|---|
| default | FxTimelineItem 列表(必填) |
FxTimelineItem Attributes
| 属性 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| timestamp | 时间戳文本 | string | '' |
| hideTimestamp | 是否隐藏时间戳 | boolean | false |
| center | 节点是否垂直居中 | boolean | false |
| placement | 时间戳相对内容的位置 | 'top' | 'bottom' | bottom |
| type | 节点颜色类型(被 color 覆盖) | 'primary' | 'success' | 'warning' | 'danger' | 'info' | '' | '' |
| color | 自定义节点颜色 | string | '' |
| size | 节点尺寸 | 'normal' | 'large' | normal |
| icon | 节点图标。字符串为 IconString 类型(即 FxIcon 图标名,如 ep:edit、ant-design:home、svg:xxx) | string | — |
| hollow | 节点是否空心 | boolean | false |
FxTimelineItem Slots
| 插槽名 | 说明 |
|---|---|
| default | 内容主体 |
| dot | 自定义节点(提供时不再渲染默认圆点节点) |
