export interface TimelineItem { /** * 日期 */ date?: string; /** * 时间 */ time?: string; /** * 图标名称 */ icon?: string; /** * 颜色,支持预设主题色或自定义颜色值 */ color?: string; /** * 图标模式:plain, line, fill */ mode?: string; /** * 图标文本 */ text?: string; /** * 内容 */ content?: string; /** * 级别,用于区分不同重要程度的事件 * 设置为2时图标会变小 */ level?: number | string; /** * 是否为活跃状态 */ active?: boolean; /** * 自定义样式 */ style?: Record; /** * 自定义类名 */ className?: string; /** * 是否显示连接线 */ showLine?: boolean; /** * 自定义元数据,用于传递额外信息 */ meta?: Record; } export type TimelineTimePosition = 'in' | 'out'; export type TimelineDirection = 'v' | 'h'; export type TimelineAlign = 'left' | 'center' | 'right'; export type TimelineMode = '' | 'plain' | 'line' | 'fill'; export interface TimelineProps { flex?: boolean; /** * 数据 */ data: TimelineItem[]; /** * 时间位置 * in: 内部 - 时间在内容区域内 * out: 外部 - 时间在节点左侧 */ timePosition?: TimelineTimePosition; /** * 方向 * v: 垂直布局 * h: 水平布局 */ dir?: TimelineDirection; /** * 全局图标模式 * 优先级高于单个项目的mode设置 */ mode?: TimelineMode; /** * 对齐方式 * left: 左对齐 * center: 居中 * right: 右对齐(仅垂直布局有效) */ align?: TimelineAlign; /** * 项目宽度,仅水平布局模式有效 * 可设为 'avg'(平均分配宽度)或具体数值(如数字或带单位的尺寸值) * 数字值将自动转换为 em 单位 */ itemWidth?: string | number; /** * 是否反转项目排序 */ reverse?: boolean; } export interface TimelineEmits { /** * 点击项目时触发 */ (e: 'click', item: TimelineItem, index: number): void; /** * 项目渲染完成后触发 */ (e: 'item-rendered', item: TimelineItem, index: number): void; }