Skip to content

Timeline时间轴

Timeline时间轴用于垂直展示时间流信息,适用于按时间排列一系列信息,支持正序和倒序排列,当需要一条时间轴进行视觉串联时也可使用。

代码演示

  1. 基本用法:创建基本的时间轴,每个a-timeline-item代表一个时间节点信息。
  • Create a services site 2015-09-01
  • Solve initial network problems 2015-09-01
  • Technical testing 2015-09-01
  • Network problems being solved 2015-09-01
vue
<template>
  <a-timeline>
    <a-timeline-item>Create a services site 2015-09-01</a-timeline-item>
    <a-timeline-item>Solve initial network problems 2015-09-01</a-timeline-item>
    <a-timeline-item>Technical testing 2015-09-01</a-timeline-item>
    <a-timeline-item>Network problems being solved 2015-09-01</a-timeline-item>
  </a-timeline>
</template>
  1. 圆圈颜色:可设置时间轴点的颜色,绿色表示已完成、成功状态,红色表示告警或错误状态,蓝色为正在进行或其他默认状态,也可使用自定义色值。同时可通过插槽自定义节点内容。
  • Create a services site 2015-09-01
  • Create a services site 2015-09-01
  • Solve initial network problems 1

    Solve initial network problems 2

    Solve initial network problems 3 2015-09-01

  • Technical testing 1

    Technical testing 2

    Technical testing 3 2015-09-01

  • Technical testing 1

    Technical testing 2

    Technical testing 3 2015-09-01

  • Technical testing 1

    Technical testing 2

    Technical testing 3 2015-09-01

  • Custom color testing

vue
<template>
  <a-timeline>
    <a-timeline-item color="green">Create a services site 2015-09-01</a-timeline-item>
    <a-timeline-item color="green">Create a services site 2015-09-01</a-timeline-item>
    <a-timeline-item color="red">
      <p>Solve initial network problems 1</p>
      <p>Solve initial network problems 2</p>
      <p>Solve initial network problems 3 2015-09-01</p>
    </a-timeline-item>
    <a-timeline-item>
      <p>Technical testing 1</p>
      <p>Technical testing 2</p>
      <p>Technical testing 3 2015-09-01</p>
    </a-timeline-item>
    <a-timeline-item color="gray">
      <p>Technical testing 1</p>
      <p>Technical testing 2</p>
      <p>Technical testing 3 2015-09-01</p>
    </a-timeline-item>
    <a-timeline-item color="gray">
      <p>Technical testing 1</p>
      <p>Technical testing 2</p>
      <p>Technical testing 3 2015-09-01</p>
    </a-timeline-item>
    <a-timeline-item color="#00CCFF">
      <template #dot>
        <SmileOutlined />
      </template>
      <p>Custom color testing</p>
    </a-timeline-item>
  </a-timeline>
</template>
<script lang="ts" setup>
import { SmileOutlined } from '@ant-design/icons-vue';
</script>
  1. 右侧时间轴点:设置mode="right",让时间轴点位于内容右边。
  • Create a services site 2015-09-01
  • Solve initial network problems 2015-09-01
  • Technical testing 2015-09-01
  • Network problems being solved 2015-09-01
vue
<template>
  <a-timeline mode="right">
    <a-timeline-item>Create a services site 2015-09-01</a-timeline-item>
    <a-timeline-item>Solve initial network problems 2015-09-01</a-timeline-item>
    <a-timeline-item>
      <template #dot><clock-circle-outlined style="font-size: 16px" /></template>
      Technical testing 2015-09-01
    </a-timeline-item>
    <a-timeline-item>Network problems being solved 2015-09-01</a-timeline-item>
  </a-timeline>
</template>
<script lang="ts" setup>
import { ClockCircleOutlined } from '@ant-design/icons-vue';
</script>

API

Timeline

参数说明类型默认值
mode改变时间轴和内容的相对位置left | alternate | right-
pending指定最后一个幽灵节点是否存在或内容boolean|string|slotfalse
pendingDot当最后一个幽灵节点存在时,指定其时间图点string|slot<LoadingOutlined />
reverse节点排序booleanfalse

Timeline.Item

参数说明类型默认值版本
color指定圆圈颜色,如blueredgreen或自定义色值stringblue-
dot自定义时间轴点string|slot--
label设置标签string | slot-3.0
position自定义节点位置left | right--