Files
2026-11-13 14:04:20 +08:00

40 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Timeline 时间轴
按时间顺序展示事件,使用 `Timeline` 和 `TimelineItem` 组合。
:::preview 基础用法
demo-preview=../demos/timeline/basic.vue
:::
容器支持 `layout`(`vertical`、`horizontal`)和 `reverse`。节点支持 `label`、`content`、`dot-color`,以及默认、`label`、`content`、`dot` 插槽。点击节点触发 `click`,参数包含事件 `e` 和节点属性 `item`。
这是基础实现,暂不支持 PC 端的全部属性和布局。
## 样式变量
可在时间轴或其祖先元素上覆盖以下 CSS 变量。圆点颜色使用节点的 `dot-color` 属性设置。
| 变量 | 默认值 | 说明 |
| --- | --- | --- |
| `--t-timeline-dot-size` | `.5rem` | 圆点宽高 |
| `--t-timeline-dot-border-width` | `2px` | 圆点边框宽度 |
| `--t-timeline-dot-background` | `var(--td-bg-color-container, #fff)` | 圆点背景 |
| `--t-timeline-line-width` | `2px` | 连接线粗细 |
| `--t-timeline-line-color` | `var(--td-component-border, #ddd)` | 连接线颜色 |
| `--t-timeline-line-gap` | `.25rem` | 连接线与圆点的间隙 |
| `--t-timeline-item-gap` | `1rem` | 纵向节点底部间距 |
| `--t-timeline-content-offset` | `1rem` | 纵向内容左侧偏移 |
| `--t-timeline-horizontal-offset` | `1.5rem` | 横向内容顶部偏移 |
| `--t-timeline-horizontal-gap` | `.75rem` | 横向节点右侧间距 |
| `--t-timeline-label-color` | `var(--td-text-color-secondary, #777)` | 时间标签颜色 |
```css
.my-timeline {
--t-timeline-dot-size: .625rem;
--t-timeline-line-color: #aaa;
--t-timeline-item-gap: 1.5rem;
}
```