2024-03-09 01:09:31 +08:00

68 lines
1.1 KiB
Markdown

---
title: 阅读统计
author: pengzhan
createTime: 2024/03/06 15:23:39
permalink: /config/plugins/reading-time/
---
## 概述
为每个页面生成字数统计与预计阅读时间。
关联插件: [@vuepress/plugin-reading-time](https://ecosystem.vuejs.press/zh/plugins/reading-time.html)
默认配置:
```ts
import { plumeTheme } from 'vuepress-theme-plume'
import { defineUserConfig } from 'vuepress'
export default defineUserConfig({
theme: plumeTheme({
plugins: {
readingTime: {
wordPerMinute: 300
}
}
}),
})
```
## 配置
### wordPerMinute
- 类型:`number`
- 默认值:`300`
每分钟阅读字数。
### locales
- 类型: `ReadingTimePluginLocaleConfig`
阅读时间插件的国际化配置。
```ts
interface ReadingTimePluginLocaleData {
/**
* 字数模板,模板中 `$word` 会被自动替换为字数
*/
word: string
/**
* 小于一分钟文字
*/
less1Minute: string
/**
* 时间模板
*/
time: string
}
interface ReadingTimePluginLocaleConfig {
[localePath: string]: ReadingTimePluginLocaleData
}
```