From 133140040bbf216bc497a98c9f2edb209649ad5f Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Mon, 2 Mar 2026 18:32:01 +0800 Subject: [PATCH] fix: store loadingText as key and localize on render (#12022) --- frontend/src/layout/index.vue | 6 ++++-- frontend/src/store/modules/global.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/layout/index.vue b/frontend/src/layout/index.vue index 87b968e9e..797946540 100644 --- a/frontend/src/layout/index.vue +++ b/frontend/src/layout/index.vue @@ -62,6 +62,7 @@ import { useRoute, useRouter } from 'vue-router'; import { loadMasterProductProFromDB, loadProductProFromDB } from '@/utils/xpack'; import { useTheme } from '@/global/use-theme'; import TaskList from '@/components/task-list/index.vue'; +import i18n from '@/lang'; const { switchTheme } = useTheme(); useResize(); @@ -80,7 +81,9 @@ const globalStore = GlobalStore(); const tabsStore = TabsStore(); const loading = ref(false); -const loadingText = ref(); +const loadingText = computed(() => + globalStore.loadingText ? i18n.global.t(`commons.loadingText.${globalStore.loadingText}`) : '', +); let timer: NodeJS.Timer | null = null; @@ -140,7 +143,6 @@ const toLogin = () => { const loadStatus = async () => { loading.value = globalStore.isLoading; - loadingText.value = globalStore.loadingText; if (loading.value) { timer = setInterval(async () => { await getSystemAvailable() diff --git a/frontend/src/store/modules/global.ts b/frontend/src/store/modules/global.ts index b2b86afee..d30cf6cce 100644 --- a/frontend/src/store/modules/global.ts +++ b/frontend/src/store/modules/global.ts @@ -77,7 +77,7 @@ const GlobalStore = defineStore({ this.isLoading = loading; }, setLoadingText(text: string) { - this.loadingText = i18n.global.t('commons.loadingText.' + text); + this.loadingText = text; }, setCsrfToken(token: string) { this.csrfToken = token;