优化pinia持久化
This commit is contained in:
12
src/App.vue
12
src/App.vue
@@ -1,4 +1,14 @@
|
||||
<script setup></script>
|
||||
<script setup>
|
||||
import { onMounted } from 'vue'
|
||||
import { useI18nStore } from './stores/modules/i18n'
|
||||
import i18n from './i18n'
|
||||
|
||||
onMounted(() => {
|
||||
// 从持久化的 store 中读取语言设置并同步到 i18n
|
||||
const i18nStore = useI18nStore()
|
||||
i18n.global.locale.value = i18nStore.currentLocale
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<router-view />
|
||||
|
||||
Reference in New Issue
Block a user