5656 * 展示各种机器人组件的信息,包括核心库和各平台组件
5757 */
5858
59+ // Vue 核心功能导入
60+ import {computed } from " vue" ;
61+
5962// Naive UI 组件导入
6063import {NA , NButton , NCard , NGi , NGrid , NImage , NImageGroup , NP , NSpace } from " naive-ui" ;
6164
6265// 统一标签组件导入
6366import UnifiedTag from " ./common/UnifiedTag.vue" ;
6467
68+ // 数据导入
69+ import repoDocCardsData from " ../data/repo-doc-cards.json" ;
70+
6571// ==================== 类型定义 ====================
6672
6773/**
@@ -96,12 +102,14 @@ interface LinkConfig {
96102 * 组件卡片数据接口
97103 */
98104interface ComponentCard {
105+ id: string ;
99106 name: string ;
100107 tags: TagConfig [];
101108 shields: ReturnType <typeof Shield >[];
102109 description: string ;
103110 links: LinkConfig [][];
104111 deprecated? : boolean ;
112+ deprecatedReason? : string ;
105113}
106114
107115// ==================== 辅助函数 ====================
@@ -124,182 +132,42 @@ function Shield(props: ShieldConfig) {
124132
125133// ==================== 预定义标签 ====================
126134
127- /** 官方标签 - 标识官方维护的组件 */
128- const officialTag: TagConfig = { name: ' Official' , type: ' info' };
129-
130- /** 核心标签 - 标识核心库组件 */
131- const coreTag: TagConfig = { name: ' 核心' , type: ' info' };
132-
133- /** 组件标签 - 标识组件库类型 */
134- const componentTag: TagConfig = { name: " 组件" , type: " success" };
135-
136- /** 开发中标签 - 标识正在开发的组件 */
137- const WIPTag: TagConfig = { name: ' <b>🚧WIP</b>' , type: ' warning' };
138-
139- /** 期待协助标签 - 标识需要社区帮助的组件 */
140- const helpWanted: TagConfig = { name: ' <b>🤝期待协助</b>' , type: ' success' };
141-
142- /** 已废弃标签 - 标识不再维护的组件 */
143- const deadTag: TagConfig = { name: ' <b>💀阵亡</b>' , type: ' error' };
144-
145- const componentCards: ComponentCard [] = [
146- {
147- name: " 核心库" ,
148- tags: [officialTag , coreTag ],
149- shields: [
150- Shield ({ src: " https://img.shields.io/github/v/release/simple-robot/simpler-robot?label=version" , alt: " 核心库" }),
151- ],
152- description: " 核心库是组件库的基础,也是绝大多数基本API存在的地方。" ,
153- links: [
154- [{name: " 前往仓库" , href: " https://github.com/simple-robot/simpler-robot" , type: " info" }],
155- [
156- {name: " API文档" , href: " main-v4/" , type: " primary" },
157- {name: " API文档(快照)" , href: " snapshots/main-v4/" , type: " primary" },
158- ],
159- [{name: " 🍀官网" , href: " https://simbot.forte.love/" , type: " default" }],
160- ]
161- },
162-
163- {
164- name: " QQ机器人组件" ,
165- tags: [officialTag , componentTag ],
166- shields: [
167- Shield ({
168- src: " https://img.shields.io/github/v/release/simple-robot/simbot-component-qq-guild?label=version" ,
169- alt: " QQ机器人组件"
170- }),
171- ],
172- description: " QQ机器人组件基于核心库对 <a href='https://bot.q.qq.com/wiki'>QQ机器人官方API</a> 进行实现,提供强大的QQ机器人平台功能。" ,
173- links: [
174- [{name: " 前往仓库" , href: " https://github.com/simple-robot/simbot-component-qq-guild" , type: " info" }],
175- [
176- {name: " API文档" , href: " components/qq-guild/" , type: " primary" },
177- {name: " API文档(快照)" , href: " snapshots/components/qq-guild/" , type: " primary" }
178- ],
179- [{name: " 前往手册" , href: " https://simbot.forte.love/component-qq-guild.html" , type: " default" }],
180- ]
181- },
182- {
183- name: " OneBot组件" ,
184- tags: [officialTag , componentTag ],
185- shields: [
186- Shield ({
187- src: " https://img.shields.io/github/v/release/simple-robot/simbot-component-onebot?label=version" ,
188- alt: " OneBot组件"
189- }),
190- ],
191- description: " OneBot组件基于核心库对 <a href='https://github.com/botuniverse/onebot-11'>OneBot11协议</a> 进行实现,提供强大的OneBot客户端功能。" ,
192- links: [
193- [{name: " 前往仓库" , href: " https://github.com/simple-robot/simbot-component-onebot" , type: " info" }],
194- [
195- {name: " API文档" , href: " components/onebot/" , type: " primary" },
196- {name: " API文档(快照)" , href: " snapshots/components/onebot/" , type: " primary" }
197- ],
198- // [{name: "前往手册", href: "https://simple-robot.github.io/simbot-component-onebot", type: "default"}],
199- [{name: " 前往手册" , href: " https://simbot.forte.love/component-onebot.html" , type: " default" }],
200- ]
201- },
202- {
203- name: " KOOK组件" ,
204- tags: [officialTag , componentTag ],
205- shields: [
206- Shield ({
207- src: " https://img.shields.io/github/v/release/simple-robot/simbot-component-kook?label=version" ,
208- alt: " KOOK组件"
209- }),
210- ],
211-
212- description: " KOOK组件基于核心库对 <a href='https://developer.kookapp.cn/doc/reference'>KOOK机器人</a> 进行实现,提供强大的KOOK机器人平台功能。" ,
213- links: [
214- [{name: " 前往仓库" , href: " https://github.com/simple-robot/simbot-component-kook" , type: " info" }],
215- [
216- {name: " API文档" , href: " components/kook/" , type: " primary" },
217- {name: " API文档(快照)" , href: " snapshots/components/kook/" , type: " primary" },
218- ],
219- [{name: " 前往手册" , href: " https://simbot.forte.love/component-kook.html" , type: " default" }],
220- ]
221- },
222- {
223- name: " Telegram组件" ,
224- tags: [WIPTag , helpWanted , officialTag , componentTag ],
225- shields: [
226- Shield ({
227- src: " https://img.shields.io/github/v/release/simple-robot/simbot-component-telegram?label=version" ,
228- alt: " Telegram组件"
229- }),
230- ],
231- description: " Telegram组件基于核心库对 <a href='https://core.telegram.org/bots/api'>Telegram Bot</a> 进行实现,提供强大的Telegram机器人平台功能。" ,
232- links: [
233- [{name: " 前往仓库" , href: " https://github.com/simple-robot/simbot-component-telegram" , type: " info" }],
234- [
235- {name: " API文档" , href: " components/telegram/" , type: " primary" },
236- {name: " API文档(快照)" , href: " snapshots/components/telegram/" , type: " primary" }
237- ],
238- [{name: " 前往手册" , href: " https://simbot.forte.love/component-telegram.html" , type: " default" }],
239- ]
240- },
241- {
242- name: " Discord组件" ,
243- tags: [WIPTag , helpWanted , officialTag , componentTag ],
244- shields: [
245- Shield ({
246- src: " https://img.shields.io/github/v/release/simple-robot/simbot-component-discord?label=version" ,
247- alt: " Discord组件"
248- }),
249- ],
250- description: " Discord组件基于核心库对 <a href='https://discord.com/developers/docs/intro'>Discord Bot</a> 进行实现,提供强大的Discord机器人平台功能。" ,
251- links: [
252- [{name: " 前往仓库" , href: " https://github.com/simple-robot/simbot-component-discord" , type: " info" }],
253- [
254- {name: " API文档" , href: " components/discord/" , type: " primary" },
255- {name: " API文档(快照)" , href: " snapshots/components/discord/" , type: " primary" }
256- ],
257- [{name: " 前往手册" , href: " https://simbot.forte.love/component-discord.html" , type: " default" }],
258- ]
259- },
260- // {
261- // name: "mirai组件",
262- // deprecated: true,
263- // tags: [Tag({ name: '⚠濒死', type: 'warning', round: false }), officialTag, componentTag],
264- // shields: [
265- // Shield({
266- // // src: "https://img.shields.io/maven-central/v/love.forte.simbot.component/simbot-component-mirai-core?&label=version",
267- // src: "https://img.shields.io/github/v/release/simple-robot/simbot-component-mirai?label=version",
268- // alt: "mirai组件"
269- // }),
270- // ],
271- // description: "Mirai组件基于核心库对 <a href='https://github.com/mamoe/mirai'>mirai框架</a> 进行实现,提供强大的QQ机器人平台功能。",
272- // links: [
273- // [{name: "前往仓库", href: "https://github.com/simple-robot/simbot-component-mirai", type: "info"}],
274- // [
275- // {name: "API文档", href: "components/mirai/", type: "primary"},
276- // {name: "API文档(快照)", href: "snapshots/components/mirai/", type: "primary"},
277- // ],
278- // [{name: "前往手册", href: "https://simple-robot.github.io/simbot-component-mirai", type: "default"}],
279- // ]
280- // },
281- // {
282- // name: "米游社大别野组件",
283- // tags: [deadTag, officialTag, componentTag],
284- // deprecated: true,
285- // shields: [
286- // Shield({
287- // src: "https://img.shields.io/github/v/release/simple-robot/simbot-component-miyoushe-villa?label=version",
288- // alt: "米游社大别野组件"
289- // }),
290- // ],
291- // description: "米游社大别野组件基于核心库对 <a href='https://open.miyoushe.com/'>米游社大别野机器人</a> 进行实现,提供强大的米游社大别野机器人平台功能。",
292- // links: [
293- // [{name: "前往仓库", href: "https://github.com/simple-robot/simbot-component-miyoushe-villa", type: "info"}],
294- // [
295- // {name: "API文档", href: "components/miyoushe-villa/", type: "primary"},
296- // {name: "API文档(快照)", href: "snapshots/components/miyoushe-villa/", type: "primary"}
297- // ],
298- // [{name: "前往手册", href: "https://simple-robot.github.io/simbot-component-miyoushe-villa/", type: "default"}],
299- // ]
300- // },
301-
302- ]
135+ /**
136+ * 预定义标签映射
137+ * 从外部JSON文件加载,提供统一的标签管理
138+ */
139+ const predefinedTags = computed <Record <string , TagConfig >>(() => {
140+ return repoDocCardsData .predefinedTags as Record <string , TagConfig >;
141+ });
142+
143+ /**
144+ * 组件卡片数据
145+ * 从外部JSON文件加载,支持灵活配置和标签引用
146+ */
147+ const componentCards = computed <ComponentCard []>(() => {
148+ const tags = predefinedTags .value ;
149+
150+ // 处理活跃卡片
151+ const processCard = (card : any ): ComponentCard => ({
152+ id: card .id ,
153+ name: card .name ,
154+ tags: card .tags .map ((tagKey : string ) => tags [tagKey ]).filter (Boolean ),
155+ shields: card .shields .map ((shield : any ) => Shield (shield )),
156+ description: card .description ,
157+ links: card .links ,
158+ deprecated: card .deprecated ,
159+ deprecatedReason: card .deprecatedReason
160+ });
161+
162+ const allCards = [... repoDocCardsData .cards .map (processCard )];
163+
164+ // 可以根据需要决定是否显示已废弃的卡片
165+ // 目前只显示活跃的卡片,如需显示废弃卡片可以取消下面的注释
166+ // allCards.push(...repoDocCardsData.deprecatedCards.map(processCard));
167+
168+ return allCards ;
169+ });
170+
303171
304172 </script >
305173
0 commit comments