File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -657,6 +657,14 @@ interface SidebarItem {
657
657
}
658
658
```
659
659
660
+ ### sidebarScrollbar
661
+
662
+ - 类型: ` boolean `
663
+ - 默认值: ` true `
664
+ - 详情: 是否显示侧边栏滚动条
665
+
666
+ 设置为 ` false ` 时,仅隐藏滚动条,但不改变滚动行为。
667
+
660
668
### aside
661
669
662
670
- 类型: ` boolean | 'left' `
Original file line number Diff line number Diff line change @@ -4,13 +4,14 @@ import VPTransitionFadeSlideY from '@theme/VPTransitionFadeSlideY.vue'
4
4
import { useScrollLock } from ' @vueuse/core'
5
5
import { onMounted , ref , watch } from ' vue'
6
6
import { useRoutePath } from ' vuepress/client'
7
- import { useSidebar } from ' ../composables/index.js'
7
+ import { useData , useSidebar } from ' ../composables/index.js'
8
8
import { inBrowser } from ' ../utils/index.js'
9
9
10
10
const props = defineProps <{
11
11
open: boolean
12
12
}>()
13
13
14
+ const { theme } = useData ()
14
15
const { sidebarGroups, hasSidebar, sidebarKey } = useSidebar ()
15
16
const routePath = useRoutePath ()
16
17
@@ -52,7 +53,7 @@ onMounted(() => {
52
53
v-if =" hasSidebar"
53
54
ref =" navEl"
54
55
class =" vp-sidebar"
55
- :class =" { open }"
56
+ :class =" { open, 'hide-scrollbar': !(theme.sidebarScrollbar ?? true) }"
56
57
vp-sidebar
57
58
@click.stop
58
59
>
@@ -114,6 +115,15 @@ onMounted(() => {
114
115
transform : translateX (0 );
115
116
}
116
117
118
+ .vp-sidebar.hide-scrollbar {
119
+ scrollbar-width : none ;
120
+ }
121
+
122
+ .vp-sidebar.hide-scrollbar ::-webkit-scrollbar {
123
+ width : 0 ;
124
+ height : 0 ;
125
+ }
126
+
117
127
[data-theme = " dark" ] .vp-sidebar {
118
128
box-shadow : var (--vp-shadow-1 );
119
129
}
Original file line number Diff line number Diff line change @@ -77,6 +77,12 @@ export interface PlumeThemeLocaleData extends LocaleData {
77
77
*/
78
78
sidebar ?: SidebarMulti
79
79
80
+ /**
81
+ * 是否显示侧边栏滚动条
82
+ * @default true
83
+ */
84
+ sidebarScrollbar ?: boolean
85
+
80
86
/**
81
87
* 要显示的标题级别。
82
88
*
You can’t perform that action at this time.
0 commit comments