xtraderClient/docs/api/mockEventList.md
2026-02-26 16:10:20 +08:00

28 lines
846 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# mockEventList.ts
**路径**`src/api/mockEventList.ts`
## 功能用途
模拟事件列表数据 `MOCK_EVENT_LIST`,用于本地开发、测试,覆盖单一 marketUp/Down、Yes/No、多 markets 轮播等场景。
## 核心能力
- 提供 `PmEventListItem[]` 格式的 mock 数据
- 包含单一 market、多 market 等多种结构
- 可与 `mapEventItemToCard` 配合使用
## 使用方式
```typescript
import { MOCK_EVENT_LIST } from '@/api/mockEventList'
import { mapEventItemToCard } from '@/api/event'
const cards = MOCK_EVENT_LIST.map(mapEventItemToCard)
```
## 扩展方式
1. **新增 mock 项**:在 `MOCK_EVENT_LIST` 中追加符合 `PmEventListItem` 结构的对象
2. **统一入口**`MOCK_EVENT_LIST` 已由 `src/api/mockData.ts` 统一导出,配合 `src/config/mock.ts``USE_MOCK_EVENT` 开关使用