QTimeline 组件按时间顺序显示事件列表。它通常是一个图形设计,显示一个长条形图,在其旁边标注日期,通常是事件。时间线可以使用任何时间尺度,具体取决于主题和数据。
QTimeline 有 3 种布局:
dense(默认) 在时间线的时间线指定侧(默认是右侧)显示头部,标题,副标题和内容。comfortable在时间线的时间线指定侧(默认是右侧)显示头部,标题和内容,在另一侧显示副标题。loose在中间显示头部,在条目指定侧(默认在右侧)显示标题和内容,在另一侧显示副标题。
QTimeline API
QTimelineEntry API
用法
基础
仅使用属性
下面是相同的示例,但仅使用 QTimelineEntry 属性而不是默认插槽:
仅使用插槽
下面再次是相同的示例,但仅使用 QTimelineEntry 插槽:
暗色设计
布局和侧面选择
WARNING
QTimelineEntry 仅在 QTimeline 具有 loose 布局时才会考虑其 side 属性。
响应式
TIP
下面的示例使用 $q.screen 检测窗口大小的变化,以查看所有 3 种布局的效果。
Accessibility v2.25+
QTimeline renders a native <ul> with each entry as a <li>, so entries read as a list. Be aware that entry titles render as h6 elements regardless of where the timeline sits in your document’s heading outline (only a heading entry lets you pick its level, through the tag prop — an h3 by default), and that avatar images carry no alt attribute — supply meaningful structure and text through the slots and props accordingly.