fix i18n initialize BUG

This commit is contained in:
KUN1007 2023-05-30 22:54:51 +08:00
parent caa295890c
commit e97814815e
2 changed files with 6 additions and 2 deletions

View file

@ -3,11 +3,14 @@ import { createI18n } from 'vue-i18n'
import zh from './zh'
import en from './en'
// 读取本地存储中的语言配置
const localStorageString = localStorage.getItem('KUNGalgame-settings')
const localStorageObject = JSON.parse(localStorageString as string)
const lang = localStorageString
? JSON.parse(localStorageString).showKUNGalgameLanguage
: 'en'
const i18n = createI18n({
locale: localStorageObject.showKUNGalgameLanguage,
locale: lang,
// 支持 Vue3 composition API
legacy: false,
// 全局注册 ts 方法

View file

@ -8,6 +8,7 @@ export const useKUNGalgamerStore = defineStore({
id: 'kungalgamer',
persist: true,
state: (): UserState => ({
// TODO:
token: 'KUNGalgame',
}),
getters: {