组件
时间线 Timeline
Timeline:时间线。Root 承载有序主线,Item 是一个时间点,Marker 是主线经过的节点,Content 是该时间点的内容;标记之间的发丝线由样式表绘制。
#基础用法
- Sketch — the first brush line settles on the paper.
- Ink — the strokes deepen and the hierarchy appears.
- Seal — the red stamp closes the finished work.
<script setup lang="ts">
import { Timeline } from "@bysages/vue";
</script>
<template>
<Timeline.Root>
<Timeline.Item>
<Timeline.Marker />
<Timeline.Content>
<strong>Sketch</strong> — the first brush line settles on the paper.
</Timeline.Content>
</Timeline.Item>
<Timeline.Item>
<Timeline.Marker />
<Timeline.Content>
<strong>Ink</strong> — the strokes deepen and the hierarchy appears.
</Timeline.Content>
</Timeline.Item>
<Timeline.Item>
<Timeline.Marker />
<Timeline.Content>
<strong>Seal</strong> — the red stamp closes the finished work.
</Timeline.Content>
</Timeline.Item>
</Timeline.Root>
</template>
- GroundThe stone is squared
- InkThe pigment meets the water
- StrokeThe hand commits
- SealThe name closes the work
<script setup lang="ts">
import { Timeline } from "@bysages/vue";
const moments = [
{ title: "Ground", note: "The stone is squared" },
{ title: "Ink", note: "The pigment meets the water" },
{ title: "Stroke", note: "The hand commits" },
{ title: "Seal", note: "The name closes the work" },
];
</script>
<template>
<Timeline.Root orientation="horizontal" class="w-full">
<Timeline.Item v-for="m in moments" :key="m.title">
<Timeline.Marker />
<Timeline.Content>
<div class="text-sm font-medium">{{ m.title }}</div>
<div class="mt-1 text-xs text-tertiary">{{ m.note }}</div>
</Timeline.Content>
</Timeline.Item>
</Timeline.Root>
</template>
#属性
#TimelineRoot
时间线容器,决定时间点纵向排列还是从左到右排列。
| 属性 | 类型 | 默认值 | 描述 |
|---|---|---|---|
orientation | String as PropType<"vertical" | "horizontal"> | "vertical" | — |
#TimelineItem
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#TimelineMarker
纯造型的部件——自身没有属性,沿用部件结构的共享样式。
#TimelineContent
纯造型的部件——自身没有属性,沿用部件结构的共享样式。