File tree Expand file tree Collapse file tree 2 files changed +29
-16
lines changed Expand file tree Collapse file tree 2 files changed +29
-16
lines changed Original file line number Diff line number Diff line change 1
1
import type { ThemeLocaleData } from 'vuepress-theme-hope'
2
+ import type { SearchProLocaleData } from 'vuepress-plugin-search-pro'
2
3
import { NotFoundMsgList } from './constant'
3
4
4
5
/**
5
6
* 支持中文
6
7
* 参考:https://theme-hope.vuejs.press/zh/config/i18n.html
7
8
*/
8
- const localCN : ThemeLocaleData = {
9
+ const themeLocalCN : ThemeLocaleData = {
9
10
lang : 'zh-CN' ,
10
11
navbarLocales : {
11
12
langName : '简体中文' ,
@@ -76,5 +77,26 @@ const localCN: ThemeLocaleData = {
76
77
* 自定义语言,支持文案
77
78
*/
78
79
export const i18n = {
79
- '/' : localCN ,
80
+ '/' : themeLocalCN ,
81
+ }
82
+
83
+ /**
84
+ * 搜索框支持中文
85
+ * 参考:https://plugin-search-pro.vuejs.press/zh/config.html#locales
86
+ */
87
+ export const searchProCNLocals : SearchProLocaleData = {
88
+ placeholder : '请输入需要搜索的关键字' ,
89
+ search : '搜索文档' ,
90
+ searching : '搜索中' ,
91
+ cancel : '取消' ,
92
+ select : '选择' ,
93
+ navigate : '切换' ,
94
+ exit : '关闭' ,
95
+ loading : '正在努力搜索中...' ,
96
+ queryHistory : '搜素文字历史' ,
97
+ resultHistory : '搜索结果' ,
98
+ emptyHistory : '没有搜索历史' ,
99
+ emptyResult : '无法找到相关结果' ,
100
+ defaultTitle : '搜索文档' ,
101
+ autocomplete : '自动补齐' ,
80
102
}
Original file line number Diff line number Diff line change 1
1
import { hopeTheme } from 'vuepress-theme-hope'
2
2
import { AUTHOR_INFO , COPYRIGHT , FOOTER_HTML_INFO } from './constant'
3
- import { i18n } from './i18n'
3
+ import { i18n , searchProCNLocals } from './i18n'
4
4
import navbar from './navbar'
5
5
import sidebar from './sidebar'
6
6
@@ -159,19 +159,10 @@ export const themeConfig = {
159
159
} ,
160
160
} ,
161
161
searchPro : {
162
- // 索引全部内容
163
- indexContent : true ,
164
- // 为分类和标签添加索引
165
- customFields : [
166
- {
167
- getter : ( page : any ) => page . frontmatter . category ,
168
- formatter : '分类:$content' ,
169
- } ,
170
- {
171
- getter : page => page . frontmatter . tag ,
172
- formatter : '标签:$content' ,
173
- } ,
174
- ] ,
162
+ // 参考:https://plugin-search-pro.vuejs.press/zh/config.html#locales
163
+ locales : {
164
+ '/' : searchProCNLocals ,
165
+ } ,
175
166
} ,
176
167
// 代码高亮:https://theme-hope.vuejs.press/zh/guide/feature/code-block.html
177
168
shiki : {
You can’t perform that action at this time.
0 commit comments