From 1e42eaba9997fe049b117ca9b84e9a1239ebea80 Mon Sep 17 00:00:00 2001 From: chufan Date: Tue, 22 Oct 2024 15:53:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(@142vip/vitepress):=20=E5=A2=9E=E5=8A=A0`t?= =?UTF-8?q?ypes`=E7=B1=BB=E5=9E=8B=E5=AF=BC=E5=87=BA=EF=BC=8C=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89=E4=B8=BB=E9=A2=98=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/vitepress/src/core/config.ts | 6 +++--- packages/vitepress/src/core/index.ts | 1 + packages/vitepress/src/core/types.ts | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 packages/vitepress/src/core/types.ts diff --git a/packages/vitepress/src/core/config.ts b/packages/vitepress/src/core/config.ts index 9877fad..97cf4b2 100644 --- a/packages/vitepress/src/core/config.ts +++ b/packages/vitepress/src/core/config.ts @@ -1,4 +1,4 @@ -import type { DefaultTheme } from 'vitepress/types/default-theme' +import type { ZhSearchConfig } from './types' /** * 中文语言包配置 @@ -40,7 +40,7 @@ export const i18n = { /** * 搜索-中文 */ -export const zhSearch: DefaultTheme.AlgoliaSearchOptions['locales'] = { +export const zhSearch: ZhSearchConfig = { root: { placeholder: '搜索文档', translations: { @@ -98,7 +98,7 @@ export const defaultThemeConfig = { metaChunk: true, themeConfig: { // 导航栏 - // i18n, + i18n, lastUpdated: { text: '最近更新时间', }, diff --git a/packages/vitepress/src/core/index.ts b/packages/vitepress/src/core/index.ts index d30c9ef..1a83d68 100644 --- a/packages/vitepress/src/core/index.ts +++ b/packages/vitepress/src/core/index.ts @@ -1,2 +1,3 @@ +export * from './types' export * from './config' export * from './vip' diff --git a/packages/vitepress/src/core/types.ts b/packages/vitepress/src/core/types.ts new file mode 100644 index 0000000..9ce2216 --- /dev/null +++ b/packages/vitepress/src/core/types.ts @@ -0,0 +1,16 @@ +import type { DefaultTheme } from 'vitepress/types/default-theme' + +/** + * 导航栏 + */ +export type NavbarConfig = DefaultTheme.NavItem[] + +/** + * 侧边栏 + */ +export type SidebarConfig = DefaultTheme.SidebarItem[] + +/** + * 搜素-中文 + */ +export type ZhSearchConfig = DefaultTheme.AlgoliaSearchOptions['locales']