feat: 将搜索页面由Strapi迁移至Direcuts

- 路由页面相关源码修改
- 类型标注与组合式API
- 相关工具函数
This commit is contained in:
2025-10-24 16:18:26 +08:00
parent 05938550e6
commit f62c4a3987
11 changed files with 309 additions and 151 deletions

View File

@ -0,0 +1,16 @@
/**
* 搜索索引转换器
* @param hit 搜索条目
* @returns 转换后的搜索条目视图模型
*
* ---
* @example
* const view = toSearchItemView(item, 'products');
*/
export function toSearchItemView<T extends MeiliSearchItemType>(
item: MeiliIndexMap[T],
type: T
): SearchItemView {
const converter = converters[type];
return converter ? converter(item) : null;
}