🐛 fix i18n init bug
This commit is contained in:
@@ -1,25 +1,12 @@
|
||||
import {defineStore} from 'pinia';
|
||||
import {ref} from 'vue';
|
||||
import pinia from "@/store/pinia.ts";
|
||||
import {parse, stringify} from "zipson/lib";
|
||||
import {ref} from "vue";
|
||||
|
||||
export const langStore = defineStore(
|
||||
'lang',
|
||||
() => {
|
||||
const lang = ref<string>('zh');
|
||||
|
||||
function setLang(value: string) {
|
||||
lang.value = value;
|
||||
}
|
||||
|
||||
function getLang() {
|
||||
return lang.value;
|
||||
}
|
||||
|
||||
return {
|
||||
lang,
|
||||
setLang,
|
||||
getLang,
|
||||
};
|
||||
},
|
||||
{
|
||||
@@ -28,14 +15,6 @@ export const langStore = defineStore(
|
||||
key: 'lang',
|
||||
storage: localStorage,
|
||||
paths: ["lang"],
|
||||
serializer: {
|
||||
deserialize: parse,
|
||||
serialize: stringify,
|
||||
},
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
export function useLangStoreWithOut() {
|
||||
return langStore(pinia);
|
||||
}
|
||||
|
@@ -2,7 +2,6 @@ import {defineStore} from 'pinia';
|
||||
import {computed, ref} from 'vue';
|
||||
import {theme} from 'ant-design-vue';
|
||||
import variables from '@/assets/styles/colors.module.scss';
|
||||
import {parse, stringify} from "zipson/lib";
|
||||
|
||||
/**
|
||||
* theme 配置
|
||||
@@ -45,10 +44,6 @@ export const useThemeStore = defineStore(
|
||||
key: 'theme',
|
||||
storage: localStorage,
|
||||
paths: ["themeName", "darkMode"],
|
||||
serializer: {
|
||||
deserialize: parse,
|
||||
serialize: stringify,
|
||||
},
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import {defineStore} from 'pinia';
|
||||
import {ref} from 'vue';
|
||||
import {User} from "@/types/user";
|
||||
import {parse, stringify} from "zipson/lib";
|
||||
|
||||
|
||||
export const useAuthStore = defineStore(
|
||||
@@ -34,10 +33,6 @@ export const useAuthStore = defineStore(
|
||||
key: 'user',
|
||||
storage: localStorage,
|
||||
paths: ["user"],
|
||||
serializer: {
|
||||
deserialize: parse,
|
||||
serialize: stringify,
|
||||
},
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@@ -1,12 +0,0 @@
|
||||
import {createPinia, Pinia} from "pinia";
|
||||
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
|
||||
import {App} from "vue";
|
||||
|
||||
const pinia: Pinia = createPinia();
|
||||
pinia.use(piniaPluginPersistedstate)
|
||||
|
||||
export function setupStore(app: App<Element>) {
|
||||
app.use(pinia);
|
||||
}
|
||||
|
||||
export default pinia;
|
Reference in New Issue
Block a user