Skip to content

Commit eece2e3

Browse files
authored
docs: add missing dateOptions for last-updated plugin (#2449)
1 parent 5be6399 commit eece2e3

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

packages/docs/docs/zh/plugin/official/plugin-last-updated.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = {
2323

2424
### transformer
2525

26-
- Type: `(timestamp: number, lang: string) => string`
26+
- 类型: `(timestamp: number, lang: string) => string`
2727
- 默认值: `undefined`
2828

2929
默认情况下,本插件为每个页面生成一个 13 位的时间戳,你可以传入一个 transformer 将其转换为你想要的任何格式。
@@ -51,7 +51,29 @@ module.exports = {
5151
```
5252

5353
::: tip
54-
如果你在 [i18n](../../guide/i18n.md) 模式下运行,你还可以使用第二个参数 `lang` 为不同语言生成时间字符串。
54+
如果你在[多语言](../../guide/i18n.md)模式下运行,你还可以使用第二个参数 `lang` 为不同语言生成时间字符串。
5555

5656
请注意,在 VuePress 中,我们遵循以下规范:[W3C > Language tags in HTML and XML](https://en.wikipedia.org/wiki/Language_localisation),因此 `zh-CN` 使用连字符(`-`)而不是下划线(`_`)。 请确保你使用的库遵循此规范,否则请自行转换。
5757
:::
58+
59+
### dateOptions
60+
61+
- 类型: `object`
62+
- 默认值: `undefined`
63+
64+
你也可以传入一个对象作为选项,以自定义时间戳的输出格式。详细信息请参阅 [`Date.prototype.toLocaleString()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString) 的选项参数。
65+
66+
```javascript
67+
module.exports = {
68+
plugins: [
69+
[
70+
'@vuepress/last-updated',
71+
{
72+
dateOptions:{
73+
hour12: false
74+
}
75+
}
76+
]
77+
]
78+
}
79+
```

0 commit comments

Comments
 (0)