Explorar o código

fix: directly set language value instead of calling method

Avoid potential tree-shaking issue with store methods in production

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
yb hai 2 semanas
pai
achega
5667dcffff
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      src/components/LangDropdown.vue

+ 4 - 1
src/components/LangDropdown.vue

@@ -19,6 +19,7 @@ import { computed } from 'vue'
 import { ArrowDown } from '@element-plus/icons-vue'
 import { Icon } from '@iconify/vue'
 import { useAppStore } from '@/store/app'
+import i18n from '@/locales'
 
 const appStore = useAppStore()
 
@@ -27,7 +28,9 @@ const currentLangLabel = computed(() => {
 })
 
 function handleLanguage(lang: string) {
-  appStore.changeLanguage(lang)
+  // 直接设置 store 的 language 值和 i18n locale
+  appStore.language = lang
+  i18n.global.locale.value = lang
 }
 </script>