File tree Expand file tree Collapse file tree 8 files changed +30
-17
lines changed Expand file tree Collapse file tree 8 files changed +30
-17
lines changed Original file line number Diff line number Diff line change 22
33## 安装
44
5- ``` shell
5+ ``` shell
66npm install
77```
88
@@ -11,15 +11,15 @@ npm install
1111``` shell
1212npm run docs:dev
1313```
14- 浏览器打开 http://localhost:5173
14+ 浏览器打开 < http://localhost:5173 >
1515
1616## 部署
1717
1818``` shell
1919npm run docs:build
2020```
2121
22- 本地预览,执行下列命令后,生成一个本地静态 Web 服务 http://localhost:4173,该服务以 .vitepress/dist 作为源文件
22+ 本地预览,执行下列命令后,生成一个本地静态 Web 服务 < http://localhost:4173 > ,该服务以 .vitepress/dist 作为源文件
2323``` shell
2424npm run docs:preview
2525```
Original file line number Diff line number Diff line change @@ -41,8 +41,28 @@ export default defineConfig({
4141 } ,
4242 ] ,
4343 search : {
44- provider : "local" ,
45- } ,
44+ provider : 'local' ,
45+ options : {
46+ locales : {
47+ zh : {
48+ translations : {
49+ button : {
50+ buttonText : '搜索文档' ,
51+ buttonAriaLabel : '搜索文档'
52+ } ,
53+ modal : {
54+ noResultsText : '无法找到相关结果' ,
55+ resetButtonTitle : '清除查询条件' ,
56+ footer : {
57+ selectText : '选择' ,
58+ navigateText : '切换'
59+ }
60+ }
61+ }
62+ }
63+ }
64+ }
65+ }
4666 } ,
4767 markdown : {
4868 toc : {
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