Skip to content

Commit b3f82f5

Browse files
committed
fix: fix DocSearch version
1 parent 4c492fe commit b3f82f5

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

src/.vuepress/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@
1919
import { defineDocSearchConfig } from '@vuepress/plugin-docsearch/client';
2020
import { computed } from 'vue';
2121
import { defineClientConfig, usePageData } from 'vuepress/client';
22+
import DocSearch from './components/DocSearch.vue';
2223
import { getDocVersion } from './utils/index.js';
2324

2425
export default defineClientConfig({
26+
enhance: ({ app }) => {
27+
app.component('DocSearch', DocSearch);
28+
},
2529
setup() {
2630
const pageData = usePageData();
2731

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!--
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
-->
18+
19+
<script setup lang="ts">
20+
import { usePageData } from 'vuepress/client';
21+
import { getDocVersion } from '../utils/index.js';
22+
import { computed } from 'vue';
23+
24+
const pageData = usePageData();
25+
26+
const docVersion = computed(() => getDocVersion(pageData.value.path));
27+
</script>
28+
29+
<template>
30+
<SearchBox :key="docVersion" />
31+
</template>

src/.vuepress/theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default hopeTheme(
3838
navbarLayout: {
3939
start: ['Brand'],
4040
center: [],
41-
end: ['Search', 'Links', 'Language', 'Outlook', 'Repo'],
41+
end: ['DocSearch', 'Links', 'Language', 'Outlook', 'Repo'],
4242
},
4343

4444
locales: {

0 commit comments

Comments
 (0)