From f1671b156f49c0a37e73788d2b03f54be9084bdc Mon Sep 17 00:00:00 2001 From: JimhHan <50871214+JimhHan@users.noreply.github.com> Date: Wed, 7 Apr 2021 22:20:50 +0800 Subject: [PATCH] Fix: theme local options --- docs/.vuepress/config.ts | 6 +++++- docs/.vuepress/theme/components/ThemeToggle.vue | 9 +++++---- docs/.vuepress/theme/index.ts | 10 +--------- docs/.vuepress/theme/layouts/Layout.vue | 4 ---- docs/.vuepress/theme/types/index.ts | 1 + docs/.vuepress/theme/types/toggle.ts | 4 ++++ 6 files changed, 16 insertions(+), 18 deletions(-) create mode 100644 docs/.vuepress/theme/types/index.ts create mode 100644 docs/.vuepress/theme/types/toggle.ts diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts index cca1e77..fec94b5 100644 --- a/docs/.vuepress/config.ts +++ b/docs/.vuepress/config.ts @@ -23,7 +23,6 @@ export default defineUserConfig({ editLinks: true, editLinkText: "帮助我们改善此页面!", enableToggle: true, - ToggleText: "切换主题", navbar: [ { text: "首页", link: "/" }, { text: "大史记", link: "/about/news.md" }, @@ -159,6 +158,11 @@ export default defineUserConfig({ themePlugins: { git: process.env.NODE_ENV === "production", }, + locales: { + "/": { + ToggleText: "切换主题", + }, + }, }, markdown: { toc: { diff --git a/docs/.vuepress/theme/components/ThemeToggle.vue b/docs/.vuepress/theme/components/ThemeToggle.vue index 31ed317..732167b 100644 --- a/docs/.vuepress/theme/components/ThemeToggle.vue +++ b/docs/.vuepress/theme/components/ThemeToggle.vue @@ -10,8 +10,8 @@ - - diff --git a/docs/.vuepress/theme/types/index.ts b/docs/.vuepress/theme/types/index.ts new file mode 100644 index 0000000..934fd73 --- /dev/null +++ b/docs/.vuepress/theme/types/index.ts @@ -0,0 +1 @@ +export * from "./toggle"; diff --git a/docs/.vuepress/theme/types/toggle.ts b/docs/.vuepress/theme/types/toggle.ts new file mode 100644 index 0000000..ecfadae --- /dev/null +++ b/docs/.vuepress/theme/types/toggle.ts @@ -0,0 +1,4 @@ +export interface ToggleOptions { + enableToggle?: boolean; + ToggleText?: string; +}