mirror of
https://github.com/halo-dev/docs.git
synced 2026-01-13 06:03:55 +08:00
Enhance cursor method documentation with additional info and clarify return types (#533)
* Enhance cursor method documentation with additional info and clarify return types * Update API changelog to include changes to cursor(postName) return structure
This commit is contained in:
@@ -12,3 +12,7 @@ description: 记录每一个版本的主题 API 变更记录,方便开发者
|
||||
### 表单定义 > 新增 `array` 组件
|
||||
|
||||
在 2.22.0 中,我们为 FormKit 表单新增了 `array` 组件,用于定义一组数据,并计划使用 `array` 组件替换原有的 `repeater` 组件。详细文档可查阅:[表单定义#array](../../developer-guide/form-schema.md#array)
|
||||
|
||||
### 文章 Finder API > 修改 `cursor(postName)` 返回结构
|
||||
|
||||
我们修改了文章 Finder API 中 `cursor(postName)` 方法的返回体结构,移除了 `current` 字段,并修改了 `previous` 和 `next` 字段类型为 `ListedPostVo`,并明确了上一篇文章是指发布时间较当前文章更早的文章,下一篇文章是指发布时间较当前文章更新的文章。详细文档可查阅:[文章 Finder API#cursor](../../developer-guide/theme/finder-apis/post.md#cursor)。
|
||||
|
||||
@@ -72,6 +72,10 @@ postFinder.cursor(postName);
|
||||
|
||||
根据文章的 `metadata.name` 获取相邻的文章(上一篇 / 下一篇)。
|
||||
|
||||
:::info 提示
|
||||
上一篇文章是指发布时间较当前文章更早的文章,下一篇文章是指发布时间较当前文章更新的文章。
|
||||
:::
|
||||
|
||||
### 参数
|
||||
|
||||
1. `postName:string` - 文章的唯一标识 `metadata.name`。
|
||||
@@ -448,9 +452,8 @@ postFinder.archives(page, size, year, month);
|
||||
|
||||
```json title="NavigationPostVo"
|
||||
{
|
||||
"previous": "#PostVo", // 上一篇文章
|
||||
"current": "#PostVo", // 当前文章
|
||||
"next": "#PostVo" // 下一篇文章
|
||||
"previous": "#ListedPostVo", // 上一篇文章,发布时间较当前文章更早的文章
|
||||
"next": "#ListedPostVo" // 下一篇文章,发布时间较当前文章更新的文章
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user