diff --git a/.vscode/settings.json b/.vscode/settings.json index 04675bdc..d06264f2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,7 +16,7 @@ "moemoe", "moemoepoint", "non-moe", - "nprogress", + "persistedstate", "Pinia", "shinnku", diff --git a/src/components/setting-panel/KUNGalgameSettingPanel.vue b/src/components/setting-panel/KUNGalgameSettingPanel.vue index 823a1f96..7167ba26 100644 --- a/src/components/setting-panel/KUNGalgameSettingPanel.vue +++ b/src/components/setting-panel/KUNGalgameSettingPanel.vue @@ -13,25 +13,13 @@ import Background from './components/Background.vue' // 导入设置面板 store import { useKUNGalgameSettingsStore } from '@/store/modules/settings' import { storeToRefs } from 'pinia' -// 导入 i18n -import { useI18n } from 'vue-i18n' // 使用设置面板的 store const settingsStore = useKUNGalgameSettingsStore() -const { showKUNGalgameMainPageWidth, showKUNGalgameLanguage } = - storeToRefs(settingsStore) +const { showKUNGalgameMainPageWidth } = storeToRefs(settingsStore) const emits = defineEmits(['close']) -/* - * 网站的语言设置 - */ -const { locale } = useI18n({ useScope: 'global' }) - -const handleChangeLanguage = () => { - locale.value = showKUNGalgameLanguage.value -} - /* 恢复所有设置为默认 */ const handleRecover = () => { settingsStore.restoreSettings() diff --git a/src/components/setting-panel/components/SwitchLanguage.vue b/src/components/setting-panel/components/SwitchLanguage.vue index 854402f6..bb7cb485 100644 --- a/src/components/setting-panel/components/SwitchLanguage.vue +++ b/src/components/setting-panel/components/SwitchLanguage.vue @@ -2,6 +2,7 @@ // 导入设置面板 store import { useKUNGalgameSettingsStore } from '@/store/modules/settings' import { storeToRefs } from 'pinia' +import { watch } from 'vue' // 导入 i18n import { useI18n } from 'vue-i18n' @@ -14,19 +15,15 @@ const { showKUNGalgameLanguage } = storeToRefs(settingsStore) */ const { locale } = useI18n({ useScope: 'global' }) -const handleChangeLanguage = () => { +watch(showKUNGalgameLanguage, () => { locale.value = showKUNGalgameLanguage.value -} +})