Skip to content

Commit

Permalink
feat(@142vip/vitepress): 增加types类型导出,支持自定义主题配置优化
Browse files Browse the repository at this point in the history
  • Loading branch information
mmdapl committed Oct 22, 2024
1 parent 5a21a03 commit 1e42eab
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/vitepress/src/core/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { DefaultTheme } from 'vitepress/types/default-theme'
import type { ZhSearchConfig } from './types'

/**
* 中文语言包配置
Expand Down Expand Up @@ -40,7 +40,7 @@ export const i18n = {
/**
* 搜索-中文
*/
export const zhSearch: DefaultTheme.AlgoliaSearchOptions['locales'] = {
export const zhSearch: ZhSearchConfig = {
root: {
placeholder: '搜索文档',
translations: {
Expand Down Expand Up @@ -98,7 +98,7 @@ export const defaultThemeConfig = {
metaChunk: true,
themeConfig: {
// 导航栏
// i18n,
i18n,
lastUpdated: {
text: '最近更新时间',
},
Expand Down
1 change: 1 addition & 0 deletions packages/vitepress/src/core/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './types'
export * from './config'
export * from './vip'
16 changes: 16 additions & 0 deletions packages/vitepress/src/core/types.ts
Original file line number Diff line number Diff line change
@@ -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']

0 comments on commit 1e42eab

Please sign in to comment.