> For AI agents: the complete documentation index is available at /apps-plugin/docs/llms.txt, the full documentation bundle is available at /apps-plugin/docs/llms-full.txt.

# 交通列表卡

`TransitCard` 用于展示航班、列车、大巴等交通票务方案。每个列表项由标题、出发信息、中转信息、到达信息和价格组成。


![TransitCard 交通列表卡效果](//lf-flow-web-cdn.doubao.com/obj/flow-doubao/goofy_deploy_edenx/flow/doubao-apps--plugin-doc/static/image/transit-card.58c9110a61.png)

## 示例

```tsx
import { TransitCard, type TransitCardItem } from '@doubao-dev/template';

const items: TransitCardItem[] = [
  {
    key: 'G102-20260730',
    title: 'G102 · 7月30日 周二',
    departureMain: '11:20',
    departureSub: '上海虹桥',
    transferTop: '4时40分',
    transferBottom: '直达',
    arrivalMain: '16:00',
    arrivalSub: '北京南',
    price: {
      value: '553',
      currency: '¥',
      prefix: '前缀',
      tone: 'highlight'
    },
    tag: {
      text: '可优惠约¥5',
      tone: 'marketing'
    },
    onRouteClick: () => console.log('view G102 route'),
    onPriceClick: () => console.log('book G102')
  },
  {
    key: 'G104-20260730',
    title: 'G104 · 7月30日 周二',
    departureMain: '12:10',
    departureSub: '上海虹桥',
    transferTop: '4时35分',
    transferBottom: '直达',
    arrivalMain: '16:45',
    arrivalSub: '北京南',
    price: {
      value: '576',
      tone: 'highlight'
    }
  }
];

export default function TrainListCard() {
  return (
    <TransitCard
      items={items}
      footer={{
        primaryActionButton: {
          text: '查看更多车次',
          onClick: () => console.log('view all')
        }
      }}
    />
  );
}
```

## 主要 Props

| Prop     | 类型                        | 说明         |
| -------- | ------------------------- | ---------- |
| `header` | `TemplateCardHeaderProps` | 标题栏及右侧操作入口 |
| `items`  | `TransitCardItem[]`       | 行程列表，全量展示  |
| `footer` | `TemplateCardFooterProps` | 底部主、次操作按钮  |

`TransitCardItem` 的常用字段包括 `key`、`title`、`departureMain`、`departureSub`、`transferTop`、`transferBottom`、`arrivalMain`、`arrivalDayOffset`、`arrivalSub`、`price`、`priceAction`、`tag`、`priceExtraLoading`、`onClick`、`onRouteClick` 和 `onPriceClick`。

## 使用说明

- 标题栏右侧展示“价格已过期”等不可点击提示时，传 `header={{ statusText: '价格已过期' }}`；其 warning 标签优先于 `header.actionText`。
- 模板会全量展示 `items`，不会自动截断为最多 4 条。需要折叠时，由业务先裁剪数据并通过 `footer` 提供“查看更多”入口。
- `price` 支持字符串、数字或配置对象；配置对象传 `{ value, currency?, prefix?, prefixTone?, tone? }`，由模板使用 `Price` Primitive 渲染；`currency` 默认是 `¥`，`prefixTone` 支持 `default | highlight | muted`，分别对应主文字色、豆包蓝和 `--neutral-70` 次级灰色，不传时前缀与价格值颜色一致。
- `price` 传数字时直接作为 `Price.value`，使用默认币种；传字符串时按首个币种符号拆为 `prefix + currency + value`，没有币种符号时整串作为 `value` 并隐藏币种。两种写法均使用 Price 的默认 `tone`。
- `priceAction` 传 `{ text, tone?, showIcon? }`，展示价格下方的操作文案；`tone` 支持豆包蓝 `highlight`（默认）和灰色 `muted`，文案、箭头及 loading 使用相同色调。`showIcon` 默认 `true`，箭头样式由模板统一管理。与 `tag` 同时传入时优先展示 `priceAction`。
- `priceExtraLoading` 默认 `false`，统一控制价格下方区域。设为 `true` 时隐藏操作文案及箭头或 Tag，保留原区域高度，并在下方区域靠右、垂直居中展示与 Button 相同的 16px 加载图标，图标右边缘与价格区域右边缘对齐。颜色跟随当前文案或标签文字并适配深浅色，加载期间屏蔽下方区域点击，上方价格不受影响。由业务控制状态；没有非空操作文案和标签时，不额外展示加载区域。
- `tag` 传 `{ text, tone? }`，`tone` 仅支持橙色 `marketing` 和灰色 `neutral`，默认 `marketing`；不传 `tag` 时继续使用原来的单价格布局。
- `title` 支持字符串、数字或直接传入的 primitive `Tag` / `Title`。
- `departureMain`、`departureSub`、`transferTop`、`transferBottom`、`arrivalMain`、`arrivalDayOffset` 和 `arrivalSub` 接受字符串或数字；`arrivalDayOffset` 用于展示跨日偏移，例如 `+1`。
- `onRouteClick` 对应左侧行程热区（含标题），`onPriceClick` 对应右侧价格热区（含标签或价格操作文案）；点击配置了回调的热区时只触发该回调，不再冒泡到列表项的 `onClick`。未配置区域回调时继续使用原有 `onClick`。
- 窄屏下模板会先压缩行程与价格之间的空白，再压缩出发、中转和到达列之间的空白；空间仍不足时隐藏价格，内容块本身保持原有宽度。
