跳至主要內容

其他界面功能

大约 1 分钟界面界面

打印按钮

试一试:

主题对打印样式进行了全面优化,默认在桌面模式的目录下会有一个打印按钮。

要隐藏打印按钮,你应该在主题选项中设置 print: false

import { hopeTheme } from "vuepress-theme-hope";

export default {
  theme: hopeTheme({
    print: false,
  }),
};




 


全屏按钮

试一试:

如果你需要这个功能,你可以在主题选项中设置 fullscreen: true

import { hopeTheme } from "vuepress-theme-hope";

export default {
  theme: hopeTheme({
    fullscreen: true,
  }),
};




 


提示

如果当前浏览器不支持全屏,则全屏按钮会自动隐藏。

返回顶部按钮

vuepress-theme-hope 通过 @vuepress/plugin-back-to-topopen in new window 添加了一个带进度条的返回顶部按钮,默认向下滚动 100px 后显示。

你可以在主题选项中设置 plugins.backToTop: false 来禁用它,或者用一个对象来设置它来自定义它的阈值距离和进度条显示:

import { defineUserConfig } from "vuepress";
import { hopeTheme } from "vuepress-theme-hope";

export default defineUserConfig({
  theme: hopeTheme({
    plugins: {
      // 禁用返回顶部按钮
      backToTop: false,

      // 或

      // 自定义返回顶部按钮
      backToTop: {
        /**
         * 显示返回顶部按钮的滚动阈值距离(以像素为单位)
         *
         * @default 100
         */
        threshold: 500,
        /**
         * 是否显示滚动进度
         *
         * @default true
         */
        progress: false,
      },
    },
  }),
});







 




 
 
 
 
 
 
 
 
 
 
 
 
 
 



RTL 布局

vuepress-theme-hope 完全支持 RTL 布局。只需在多语言配置内的对应语言设置 rtl: true

试一试:

import { hopeTheme } from "vuepress-theme-hope";

export default {
  theme: hopeTheme({
    locales: {
      // ...
      "/ar/": {
        // enable RTL layout
        rtl: true,
      },
    },
  }),
};