Skip to content

Commit 6e2a592

Browse files
committed
fix: fixed version display and active search plugin
1 parent a3f63fd commit 6e2a592

File tree

5 files changed

+47
-962
lines changed

5 files changed

+47
-962
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<template>
2+
Latest stable version: <span class="bold">{{ version }}</span>
3+
</template>
4+
5+
<script setup lang="ts">
6+
import { useThemeData } from '@vuepress/plugin-theme-data/client'
7+
import { ref } from 'vue'
8+
9+
const themeData = useThemeData()
10+
11+
const version = ref(themeData.value.version)
12+
</script>
13+
14+
<style scoped>
15+
.bold {
16+
font-weight: bolder;
17+
}
18+
</style>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
declare module '@vuepress/plugin-theme-data/client' {
2+
import type { DefaultThemeData } from '@vuepress/theme-default'
3+
import type { Ref } from 'vue'
4+
5+
export declare function useThemeData(): Ref<DefaultThemeData>
6+
}

docs/.vuepress/config.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import tabsPlugin from '@snippetors/vuepress-plugin-tabs'
22
import { googleAnalyticsPlugin } from '@vuepress/plugin-google-analytics'
33
import { pwaPlugin } from '@vuepress/plugin-pwa'
44
import { registerComponentsPlugin } from '@vuepress/plugin-register-components'
5+
import { searchPlugin } from '@vuepress/plugin-search'
56
import { defaultTheme } from '@vuepress/theme-default'
67
import {
78
defineUserConfig,
@@ -12,6 +13,7 @@ import {
1213
type HeadConfig,
1314
type HeadTagEmpty
1415
} from 'vuepress'
16+
import { version } from '../../package.json'
1517

1618
const GA_MEASUREMENT_ID = 'UA-82107035-1'
1719
const GOOGLE_SITE_VERIFICATION = '4nm40QLVcDJmEJSAbrMfZ7fpBJZIXL1oSngBAYrZopY'
@@ -28,6 +30,7 @@ export default defineUserConfig({
2830
head: getHead(),
2931
plugins: getPlugins(),
3032
theme: defaultTheme({
33+
version,
3134
logo: '/assets/img/logo.png',
3235
repo: 'krisk/fuse',
3336
docsDir: 'docs',
@@ -93,6 +96,7 @@ function getPlugins(): PluginConfig {
9396
// id: GOOGLE_AD_CLIENT_ID,
9497
// },
9598
// ],
99+
searchPlugin(),
96100
googleAnalyticsPlugin({
97101
id: GA_MEASUREMENT_ID
98102
}),
@@ -105,7 +109,8 @@ function getPlugins(): PluginConfig {
105109
...getComponent('Team'),
106110
...getComponent('Jobs'),
107111
...getComponent('Donate'),
108-
...getComponent('TwitterFollow')
112+
...getComponent('TwitterFollow'),
113+
...getComponent('Version')
109114
}
110115
}),
111116
pwaPlugin()
@@ -178,3 +183,9 @@ function getHead(): HeadConfig[] {
178183
...scripts
179184
]
180185
}
186+
187+
declare module '@vuepress/theme-default' {
188+
export interface DefaultThemeLocaleData {
189+
version: string
190+
}
191+
}

docs/getting-started/installation.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Installation
22

3-
Latest stable version: **{{ $themeConfig.version }}**
3+
<Version />
44

55
### NPM
66

77
```sh
8-
$ npm install fuse.js
8+
npm install fuse.js
99
```
1010

1111
### Yarn
1212

1313
```sh
14-
$ yarn add fuse.js
14+
yarn add fuse.js
1515
```
1616

1717
#### Importing

0 commit comments

Comments
 (0)