Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/plugins/features/back-to-top.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ icon: arrow-up-to-line

<NpmBadge package="@vuepress/plugin-back-to-top" />

This plugin will add a _back to top_ button to your site. The button will be displayed in the bottom right corner of the page when scrolling down. By clicking the button, the page will scroll to the top.
This plugin adds a _back to top_ button to your site. The button appears in the bottom right corner when scrolling down and scrolls the page to the top when clicked.

This plugin has been integrated into the default theme.

Expand All @@ -30,13 +30,13 @@ export default {

- Type: `number`
- Default: `100`
- Details: Scroll threshold distance to display back to top button (in pixels)
- Details: Scroll threshold distance to display the back to top button (in pixels)

### progress

- Type: `boolean`
- Default: `true`
- Details: Whether display progress bar around icon
- Details: Whether to display scroll progress

## Styles

Expand Down
10 changes: 5 additions & 5 deletions docs/zh/plugins/features/back-to-top.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ icon: arrow-up-to-line

<NpmBadge package="@vuepress/plugin-back-to-top" />

该插件会给你的站点添加一个 _返回顶部_ 按钮。当页面向下滚动时,该按钮会显示在页面的右下角,点击它就会滚动到页面顶部
该插件会给你的站点添加一个 _返回顶部_ 按钮。当页面向下滚动时,该按钮会显示在页面的右下角。点击该按钮,页面会滚动到顶部

该插件已经集成到默认主题中。

Expand All @@ -28,15 +28,15 @@ export default {

### threshold

- 类型:`数字`
- 类型:`number`
- 默认值:`100`
- 详情:显示返回顶部按钮的滚动阈值距离(以像素为单位
- 详情:滚动距离阈值,用于显示返回顶部按钮(单位:像素

### progress

- 类型:`布尔值`
- 类型:`boolean`
- 默认值:`true`
- 详情:是否在图标周围显示进度条
- 详情:是否显示滚动进度

## 样式

Expand Down
14 changes: 14 additions & 0 deletions plugins/features/plugin-back-to-top/src/node/backToTopPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@ import type { BackToTopPluginOptions } from './options.js'

const __dirname = import.meta.dirname || getDirname(import.meta.url)

/**
* Back to top plugin
*
* 返回顶部插件
*
* @example
* ```ts
* import { backToTopPlugin } from '@vuepress/plugin-back-to-top'
*
* export default {
* plugins: [backToTopPlugin()]
* }
* ```
*/
export const backToTopPlugin =
(options: BackToTopPluginOptions = {}): Plugin =>
(app) => {
Expand Down
6 changes: 3 additions & 3 deletions plugins/features/plugin-back-to-top/src/node/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import type { BackToTopPluginLocaleData } from '../shared/index.js'

export interface BackToTopPluginOptions {
/**
* Scroll threshold distance to display back to top button (in pixels)
* Scroll threshold distance to display the back to top button (in pixels)
*
* 滚动距离阈值,用于显示返回顶部按钮 (单位: 像素)
* 滚动距离阈值,用于显示返回顶部按钮(单位:像素)
*
* @default 100
*/
threshold?: number

/**
* Whether display scroll progress
* Whether to display scroll progress
*
* 是否显示滚动进度
*
Expand Down
2 changes: 1 addition & 1 deletion plugins/features/plugin-back-to-top/src/shared/locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export interface BackToTopPluginLocaleData {
/**
* Back to top button label text
*
* 返回顶部文字
* 返回顶部按钮标签文字
*/
backToTop: string
}
Loading