PageLastCommit 组件在文档页面显示最后更新时间、作者和提交信息。PageLastCommit 组件用于显示当前文档页面的最后更新信息,包括:
该组件已内置于文档页面的页头区域,无需手动添加。
组件会在页面描述下方显示类似以下内容:
最后更新于 2025/11/26 14:37 由
mhaibaraai提交docs: 完善文档内容并新增模板说明
在 .env 文件中配置 GitHub Personal Access Token:
NUXT_GITHUB_TOKEN=ghp_your_personal_access_token_here
确保在 app.config.ts 中正确配置了 GitHub 相关信息:
export default defineAppConfig({
github: {
rootDir: 'docs', // 文档所在目录
}
})
通过 dateFormat 配置可以自定义日期显示格式:
export default defineAppConfig({
github: {
rootDir: 'docs',
dateFormat: {
locale: 'zh-CN',
options: {
year: 'numeric',
month: 'numeric',
day: 'numeric',
hour: '2-digit',
minute: '2-digit'
}
}
}
})
| 配置 | 输出示例 |
|---|---|
{ year: 'numeric', month: 'short', day: 'numeric' } | 2025年11月26日 |
{ year: 'numeric', month: 'numeric', day: 'numeric' } | 2025/11/26 |
{ year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' } | 2025/11/26 14:37 |
{ dateStyle: 'full' } | 2025年11月26日星期三 |
{ dateStyle: 'medium', timeStyle: 'short' } | 2025年11月26日 14:37 |
dateFormat.options 使用标准的 Intl.DateTimeFormatOptions 配置。组件智能处理 GitHub 的 PR squash merge 场景:
web-flow(GitHub 自动合并机器人)时#123)| Prop | Default | Type |
|---|---|---|
stem | '' | string文件路径(不含扩展名),通常由页面自动传入 |
extension | 'md' | string文件扩展名,通常由页面自动传入 |
showMessage | true | boolean是否显示提交信息。 |
showAvatar | true | boolean是否显示作者头像。 |