File tree Expand file tree Collapse file tree 1 file changed +5
-12
lines changed
docs/.vitepress/theme/components Expand file tree Collapse file tree 1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change 11<script setup lang="ts">
22import { useData } from " vitepress" ;
33import {
4+ ChapterItem ,
45 ChapterItems ,
56 Chapters ,
67 isChapter ,
78} from " ../../../.vitepress/theme/constrants/route" ;
8-
9- function apply_prefix(link : string , prefix : string ) {
10- if (! prefix ) return link ;
11- if (link .startsWith (" /" ) && prefix .endsWith (" /" )) {
12- return prefix .slice (0 , - 1 ) + link ;
13- } else if (! link .startsWith (" /" ) && ! prefix .endsWith (" /" )) {
14- return prefix + " /" + link ;
15- }
16- return prefix + link ;
17- }
9+ import { apply_prefix } from " ../utils" ;
1810
1911const { chapter : chapter_root, root = true } = defineProps <{
2012 // 参数chapter应该是如 Chapter.xrobot_device这样的
@@ -28,12 +20,13 @@ const base = site.value.base;
2820
2921// console.log("contents");
3022let chapter_name: string [] = [];
31- let tocs: { link : string ; text : string } [][] = [];
23+ let tocs: ChapterItem [][] = [];
3224
3325// console.log("chapter_root", chapter_root);
3426// console.log("ChapterItems[chapter_root]", ChapterItems[chapter_root]);
3527
36- const items = ChapterItems [chapter_root ];
28+ const items: ChapterItem [] = ChapterItems [chapter_root ];
29+
3730if (! items ) {
3831 const { page } = useData ();
3932 console .warn (
You can’t perform that action at this time.
0 commit comments