From 9eb218b235c8d26cbd6101774adba6b359fa5efc Mon Sep 17 00:00:00 2001 From: lanzhihui <503792708@qq.com> Date: Fri, 30 Jan 2026 15:12:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vuepress/config.js | 12 ++++++++++++ docs/.vuepress/styles/palette.scss | 19 ++++++++++++++++++- package.json | 3 ++- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index decde56..24e3b61 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -3,6 +3,8 @@ import { defaultTheme } from '@vuepress/theme-default' import { defineUserConfig } from 'vuepress' import fs from 'fs-extra' import path from 'path' +import { searchPlugin } from '@vuepress/plugin-search' + // import * as path from "path"; // const path = require("path"); @@ -255,6 +257,16 @@ export default defineUserConfig({ } } }], + searchPlugin({ + // 可选:自定义最大建议条数 + maxSuggestions: 10, + + // 可选:设置触发搜索的快捷键(支持多个) + hotKeys: ['s', '/'], + + // 可选:自定义搜索索引字段(默认包含 title 和 frontmatter) + // getExtraFields: (page) => page.frontmatter.tags, + }), // registerComponentsPlugin({ // // 配置项 // componentsDir: path.resolve(__dirname, '../../', 'components'), // 自动注册全局组件, diff --git a/docs/.vuepress/styles/palette.scss b/docs/.vuepress/styles/palette.scss index 1b12656..90b5ff1 100644 --- a/docs/.vuepress/styles/palette.scss +++ b/docs/.vuepress/styles/palette.scss @@ -13,7 +13,7 @@ } .vp-sidebar-children { //.vp-sidebar-item{ - .vp-sidebar-children {+ + .vp-sidebar-children { .vp-sidebar-item { //li{ @@ -73,3 +73,20 @@ .vp-navbar-item:hover { color: #299764; } +.search-box input{ + padding-inline: 2rem!important; +} +// 水印样式兼容:确保不被侧边栏/导航栏遮挡 +.watermark-container { + z-index: 9999 !important; + // 避开VuePress默认主题的层级,不遮挡你的侧边栏/导航栏 + &:not(.vp-sidebar):not(.vp-navbar) { + pointer-events: none !important; + } +} + +// 深色主题适配(如果后续开启深色模式,保留这段) +body.dark .watermark-content::before { + color: #ffffff !important; + opacity: 0.2 !important; +} diff --git a/package.json b/package.json index c432c3c..ccbcc53 100644 --- a/package.json +++ b/package.json @@ -21,8 +21,9 @@ "dependencies": { "@fortawesome/fontawesome-free": "^6.7.2", "@vuepress/plugin-medium-zoom": "^2.0.0-rc.86", + "@vuepress/plugin-search": "^2.0.0-rc.86", "@vueuse/core": "^13.5.0", - "axios": "^1.10.0", + "axios": "^1.12.0", "pinia": "^3.0.3", "vue-router": "^4.5.1", "vuepress-plugin-seo": "^0.2.0"