Files
hotnow/AGENTS.md
2026-03-26 01:03:33 +08:00

31 lines
1.2 KiB
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.
# AGENTS.md
使用 fetch 获取热榜数据,定义了一个 `HotListItem` 类型来描述热榜子项的结构。每个热榜子项包含一个唯一的 `id`、标题、可选的描述、封面图、热度信息、提示信息、URL 地址、移动端 URL 地址、标签以及原始数据。
```ts
/**
* @description: 热榜子项
*/
export type HotListItem = {
id: string | number; // 唯一 key
title: string; // 标题
description?: string; // 描述
cover?: string; // 封面图
hot?: number | string; // 热度
tip?: string; // 如果不显示热度,显示其他信息
url: string; // 地址
mobileUrl?: string; // 移动端地址
label?: string; // 标签(微博)
originData?: any; // 原始数据
};
```
每一个模块有一个 label代表这个模块的功能。同时每一个模块会导出一个 main 函数main 函数会返回一个 PromisePromise resolve 的值是一个 HotListItem 数组,代表这个模块获取到的热榜数据。
## hotnow 模块
单独的 api 的模块,纯粹负责获取数据,不涉及任何 UI 相关的东西。这样做的好处是可以让数据获取和 UI 展示解耦,方便后续维护和扩展。
## 其他模块
使用 bun 运行