add internationalization / dynamic themes

This commit is contained in:
landaiqing
2024-08-09 19:51:56 +08:00
parent c13613ec07
commit 438965f2a2
28 changed files with 402 additions and 391 deletions

View File

@@ -0,0 +1,37 @@
import {defineStore} from 'pinia';
import {ref} from 'vue';
import pinia from "@/store/pinia.ts";
export const langStore = defineStore(
'lang',
() => {
const lang = ref<string>('');
function setLang(value: string) {
lang.value = value;
}
function getLang() {
return lang.value;
}
return {
lang,
setLang,
getLang,
};
},
{
// 开启数据持久化
persistedState: {
key: 'lang',
storage: localStorage,
includePaths: ["lang"],
overwrite: true,
}
}
);
export function useLangStoreWithOut() {
return langStore(pinia);
}