9
9
} from " vue" ;
10
10
import { render_list } from " @/assets/ts/leftbar" ;
11
11
import { LEFTBAR_STATUS } from " @/assets/ts/types" ;
12
+ import { OverlayScrollbarsComponent } from " overlayscrollbars-vue" ;
12
13
import hotkeys from " hotkeys-js" ;
13
14
import Search from " ./Search.vue" ;
14
15
@@ -19,12 +20,18 @@ import config from "@cache/config";
19
20
import type { Ref } from " vue" ;
20
21
import type { JSX } from " vue/jsx-runtime" ;
21
22
import type { HotkeysEvent } from " hotkeys-js" ;
23
+ import type { PartialOptions } from " overlayscrollbars" ;
22
24
23
25
const props = defineProps <{
24
26
status: LEFTBAR_STATUS ;
25
27
currentCategory: string ;
26
28
}>();
27
29
30
+ const osOptions: PartialOptions = {
31
+ scrollbars: { autoHide: " move" },
32
+ overflow: { x: " hidden" },
33
+ };
34
+
28
35
/** Attributes attached to a category */
29
36
interface Category {
30
37
name: string ;
@@ -194,9 +201,16 @@ watchEffect(() => {
194
201
</template >
195
202
</div >
196
203
197
- <Transition name =" content" >
198
- <component class =" content" :is =" VBody" v-if =" do_show_detail" />
199
- </Transition >
204
+ <OverlayScrollbarsComponent
205
+ element =" div"
206
+ class =" content-wrapper"
207
+ :options =" (osOptions as any)"
208
+ defer
209
+ >
210
+ <Transition name =" content" >
211
+ <component class =" content" :is =" VBody" v-if =" do_show_detail" />
212
+ </Transition >
213
+ </OverlayScrollbarsComponent >
200
214
201
215
<!-- https://cn.vuejs.org/guide/built-ins/teleport.html -->
202
216
<Teleport to =" body" >
@@ -326,51 +340,54 @@ $width = $toc-offset-left + $toc-width;
326
340
text-decoration-style : wavy ;
327
341
text-decoration-color : $item-underline-color ;
328
342
329
- .content
343
+ .content-wrapper
330
344
position : absolute ;
331
345
left : $toc-offset-left ;
332
346
top : $toc-offset-top ;
333
347
width : $toc-width ;
334
- display : block ;
335
- border-radius : $background-radius ;
336
- padding : 15px 0 ;
337
-
338
- .content .title
339
- color : var (-- toc-color );
340
- font-size : 0.95rem ;
341
- line-height : $toc-title-height ;
342
- margin-bottom : 5px ;
343
- padding-right : 10px ;
344
- display : flex ;
345
- gap : 8px ;
346
- transition : color 0.2s ;
347
-
348
- .content .title.router-link-exact-active .text
349
- color : $theme-color ;
350
-
351
- .content .title .sign
352
- color : $theme-color ;
353
- opacity : 0 ;
354
- transition : opacity 0.1s ;
355
- font-size : 0.7rem ;
356
- display : block ;
357
- animation : shake-x 1s infinite ease-in-out ;
358
-
359
- .content .title .text
360
- text-indent : 0 - $toc-title-indent ;
361
- padding-left : $toc-title-indent ;
362
-
363
- .content .title :hover .text
364
- color : $theme-color ;
365
-
366
- .content .title :hover .sign
367
- opacity : 1 ;
368
-
369
- .content .children
370
- margin-left : 1rem ;
371
-
372
- .content > .children
373
- margin : 0 ;
348
+ bottom : 0 ;
349
+
350
+ .content
351
+ position : absolute ;
352
+ border-radius : $background-radius ;
353
+ padding : 15px 0 ;
354
+
355
+ .title
356
+ color : var (-- toc-color );
357
+ font-size : 0.95rem ;
358
+ line-height : $toc-title-height ;
359
+ margin-bottom : 5px ;
360
+ padding-right : 10px ;
361
+ display : flex ;
362
+ gap : 8px ;
363
+ transition : color 0.2s ;
364
+
365
+ .title.router-link-exact-active .text
366
+ color : $theme-color ;
367
+
368
+ .title .sign
369
+ color : $theme-color ;
370
+ opacity : 0 ;
371
+ transition : opacity 0.1s ;
372
+ font-size : 0.7rem ;
373
+ display : block ;
374
+ animation : shake-x 1s infinite ease-in-out ;
375
+
376
+ .title .text
377
+ text-indent : 0 - $toc-title-indent ;
378
+ padding-left : $toc-title-indent ;
379
+
380
+ .title :hover .text
381
+ color : $theme-color ;
382
+
383
+ .title :hover .sign
384
+ opacity : 1 ;
385
+
386
+ .children
387
+ margin-left : 1rem ;
388
+
389
+ & > .children
390
+ margin : 0 ;
374
391
375
392
.content-enter-active ,
376
393
.content-leave-active
0 commit comments