mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
fix: 处理切换语言,UI框架不会变的问题
This commit is contained in:
+3
-3
@@ -1,10 +1,10 @@
|
||||
import type { App } from 'vue';
|
||||
import { createPinia } from 'pinia';
|
||||
|
||||
const store = createPinia();
|
||||
const pinia = createPinia();
|
||||
|
||||
export function setupStore(app: App<Element>) {
|
||||
app.use(store);
|
||||
app.use(pinia);
|
||||
}
|
||||
|
||||
export { store };
|
||||
export { pinia };
|
||||
|
||||
@@ -6,10 +6,8 @@ import i18n from '@/i18n/index'
|
||||
import { setLocalStorage, getLocalStorage, reloadRoutePage } from '@/utils'
|
||||
import { StorageEnum } from '@/enums/storageEnum'
|
||||
import { useSettingStore } from '@/store/modules/settingStore/settingStore'
|
||||
const settingStore = useSettingStore()
|
||||
|
||||
const { GO_LANG_STORE } = StorageEnum
|
||||
|
||||
const storageLang: LangStateType = getLocalStorage(GO_LANG_STORE)
|
||||
|
||||
// 语言
|
||||
@@ -17,7 +15,7 @@ export const useLangStore = defineStore({
|
||||
id: 'useLangStore',
|
||||
state: (): LangStateType =>
|
||||
storageLang || {
|
||||
lang,
|
||||
lang
|
||||
},
|
||||
getters: {
|
||||
getLang(): LangEnum {
|
||||
@@ -26,6 +24,8 @@ export const useLangStore = defineStore({
|
||||
},
|
||||
actions: {
|
||||
changeLang(lang: LangEnum): void {
|
||||
const settingStore = useSettingStore()
|
||||
|
||||
if (this.lang === lang) return
|
||||
this.lang = lang
|
||||
i18n.global.locale = lang
|
||||
|
||||
Reference in New Issue
Block a user