From d485e095ae07200b1e42dba41d2968dd0ecd762f Mon Sep 17 00:00:00 2001 From: snowykami Date: Sun, 1 Sep 2024 18:25:37 +0800 Subject: [PATCH] =?UTF-8?q?:memo:=20[docs]:=20=E6=96=B0=E5=A2=9E=E5=9C=A8?= =?UTF-8?q?=E7=BA=BF=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vitepress/theme/index.ts | 11 +- docs/components/StatsBar.vue | 49 ++++---- docs/components/StatsBarBak.vue | 174 +++++++++++++++++++++++++++ docs/components/scripts/githubAPI.ts | 0 docs/components/scripts/i18n.ts | 27 +++++ docs/components/scripts/i18nData.ts | 27 ----- docs/en/index.md | 3 - docs/package.json | 3 +- docs/tsconfig.json | 2 +- docs/zh/index.md | 4 - 10 files changed, 241 insertions(+), 59 deletions(-) create mode 100644 docs/components/StatsBarBak.vue delete mode 100644 docs/components/scripts/githubAPI.ts create mode 100644 docs/components/scripts/i18n.ts delete mode 100644 docs/components/scripts/i18nData.ts diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index c6a5bc2d..5c2cd1b8 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -1,4 +1,13 @@ +import type {Theme} from "vitepress"; + import DefaultTheme from 'vitepress/theme' import './liteyuki.css' -export default DefaultTheme \ No newline at end of file +import StatsBar from '../../components/StatsBar.vue' + +export default { + extends: DefaultTheme, + enhanceApp({app}) { + app.component('StatsBar', StatsBar) + }, +} satisfies Theme \ No newline at end of file diff --git a/docs/components/StatsBar.vue b/docs/components/StatsBar.vue index 700602e2..de343200 100644 --- a/docs/components/StatsBar.vue +++ b/docs/components/StatsBar.vue @@ -1,32 +1,39 @@ - diff --git a/docs/components/StatsBarBak.vue b/docs/components/StatsBarBak.vue new file mode 100644 index 00000000..6a152dca --- /dev/null +++ b/docs/components/StatsBarBak.vue @@ -0,0 +1,174 @@ + + + + + \ No newline at end of file diff --git a/docs/components/scripts/githubAPI.ts b/docs/components/scripts/githubAPI.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/components/scripts/i18n.ts b/docs/components/scripts/i18n.ts new file mode 100644 index 00000000..66b09a4b --- /dev/null +++ b/docs/components/scripts/i18n.ts @@ -0,0 +1,27 @@ +import {useData} from "vitepress"; + +const i18nData = { + "zh": { + online: '当前在线', + offline: '离线', + total: '全球实例', + fetching: '获取中', + }, + "en": { + online: 'Online', + offline: 'Offline', + total: 'Total', + fetching: 'Fetching', + } +} + +export default function getText(key: string): string { + // 转换语言 + // zh-Hans -> zh + // en-US -> en + if (useData().site.value.lang.includes('-')) { + return i18nData[useData().site.value.lang.split('-')[0]][key]; + } else { + return i18nData[useData().site.value.lang][key]; + } +} \ No newline at end of file diff --git a/docs/components/scripts/i18nData.ts b/docs/components/scripts/i18nData.ts deleted file mode 100644 index ec3c1320..00000000 --- a/docs/components/scripts/i18nData.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {useData} from "vitepress"; - -const i18nData = { - "zh": { - online: '当前在线', - offline: '离线', - total: '全球实例', - fetching: '获取中', - }, - "en": { - online: 'Online', - offline: 'Offline', - total: 'Total', - fetching: 'Fetching', - } -} - -export default function getText(key: string): string { - // 转换语言 - // zh-Hans -> zh - // en-US -> en - if (useData().site.value.lang.includes('-')) { - return i18nData[useData().site.value.lang.split('-')[0]][key]; - } else { - return i18nData[useData().site.value.lang][key]; - } -} \ No newline at end of file diff --git a/docs/en/index.md b/docs/en/index.md index 8688135b..dec04b47 100644 --- a/docs/en/index.md +++ b/docs/en/index.md @@ -61,7 +61,4 @@ features: --- - \ No newline at end of file diff --git a/docs/package.json b/docs/package.json index 73a1c9dd..716be997 100644 --- a/docs/package.json +++ b/docs/package.json @@ -10,7 +10,6 @@ }, "type": "module", "dependencies": { - "clipboard": "^2.0.11", - "vue": "^3.4.38" + "clipboard": "^2.0.11" } } \ No newline at end of file diff --git a/docs/tsconfig.json b/docs/tsconfig.json index f912f254..95259167 100644 --- a/docs/tsconfig.json +++ b/docs/tsconfig.json @@ -7,7 +7,7 @@ "forceConsistentCasingInFileNames": true }, "include": [ - "components/**/*.ts" + "components/**/*.ts", ], "exclude": [ "node_modules" diff --git a/docs/zh/index.md b/docs/zh/index.md index bcbc269c..73b33166 100644 --- a/docs/zh/index.md +++ b/docs/zh/index.md @@ -60,8 +60,4 @@ features: link: https://github.com/LiteyukiStudio/LiteyukiStudioOpensourceLICENSE --- - -