From d952f8606f5325028ab4a60b71cd8c3a4aef37a3 Mon Sep 17 00:00:00 2001 From: CritasWang Date: Tue, 13 May 2025 15:58:32 +0800 Subject: [PATCH 1/2] add model choice --- src/.vuepress/components/Sidevar.vue | 114 ++++++++++++++++++++++++--- src/.vuepress/utils/getDocVersion.ts | 2 + 2 files changed, 104 insertions(+), 12 deletions(-) diff --git a/src/.vuepress/components/Sidevar.vue b/src/.vuepress/components/Sidevar.vue index 6293387de..e160ac5d5 100644 --- a/src/.vuepress/components/Sidevar.vue +++ b/src/.vuepress/components/Sidevar.vue @@ -2,19 +2,24 @@ @@ -24,10 +29,11 @@ import { useSidebarItems } from "vuepress-theme-hope/modules/sidebar/composables/index.js"; import Sidebar from 'vuepress-theme-hope/modules/sidebar/components/Sidebar.js'; import { ref, watch, computed } from 'vue'; -import { useRoute } from 'vuepress/client'; -import { getDialect, getDocVersion } from '../utils/index.js'; +import { useRoute, withBase, useRouter } from 'vuepress/client'; +import { getDialect, getDocVersion, URL_SUFFIX } from '../utils/index.js'; const route = useRoute(); +const router = useRouter(); const currentLang = ref('zh'); const currentVersion = ref(''); const currentDialect = ref(''); @@ -36,9 +42,11 @@ const ModelName = computed(() => { return currentLang.value === 'zh' ? { 'Tree': '树模型', 'Table': '表模型', + 'Tip': '模型选择说明', } : { 'Tree': 'Tree', 'Table': 'Table', + 'Tip': 'Model Choice Description', }; }); @@ -47,14 +55,17 @@ const sidebarItems = useSidebarItems(); function handleChangeDialect(val: string) { const oldPath = 'latest'; const newPath = 'latest-Table'; - if(currentDialect.value ==='Table'){ + if (currentDialect.value === 'Table') { window.location.href = window.location.href.replace(newPath, oldPath); } else { window.location.href = window.location.href.replace(oldPath, newPath); } - // window.location.href = `${window.location.origin}/docs${currentLang.value === 'zh' ? currentVersion.value.link : currentVersion.value.enLink}`.replace(currentDialect.value, val); } +function handleHelpClick() { + const modelLink = withBase((currentLang.value === 'zh' ? 'zh/' : '') + 'UserGuide/' + currentVersion.value + '/Background-knowledge/Data-Model-and-Terminology' + URL_SUFFIX + '.html'); + router.push(modelLink); +} watch( () => route.path, @@ -66,10 +77,89 @@ watch( } else { currentLang.value = 'en'; } - currentVersion.value = getDocVersion(newVal,'latest'); - currentDialect.value = getDialect(newVal,''); + currentVersion.value = getDocVersion(newVal, 'latest'); + currentDialect.value = getDialect(newVal, ''); } }, { immediate: true }, ); - \ No newline at end of file + + + \ No newline at end of file diff --git a/src/.vuepress/utils/getDocVersion.ts b/src/.vuepress/utils/getDocVersion.ts index ebf261c87..cfd6359bd 100644 --- a/src/.vuepress/utils/getDocVersion.ts +++ b/src/.vuepress/utils/getDocVersion.ts @@ -55,3 +55,5 @@ export const getDialect = (path = '', defaultValue = '') => { } return defaultValue; }; + +export const URL_SUFFIX = '_apache'; \ No newline at end of file From 1adaa1f00b4b0bd14d07fe54614cd43e6057a081 Mon Sep 17 00:00:00 2001 From: CritasWang Date: Tue, 13 May 2025 16:17:06 +0800 Subject: [PATCH 2/2] change more big --- src/.vuepress/components/Sidevar.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/.vuepress/components/Sidevar.vue b/src/.vuepress/components/Sidevar.vue index e160ac5d5..c2f25e087 100644 --- a/src/.vuepress/components/Sidevar.vue +++ b/src/.vuepress/components/Sidevar.vue @@ -3,7 +3,7 @@