23 lines
544 B
TypeScript
23 lines
544 B
TypeScript
|
|||
|
|
import { defineStore } from 'pinia'
|
||
|
|
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
||
|
|
import en from 'element-plus/dist/locale/en.mjs'
|
||
|
|
import zhTw from 'element-plus/dist/locale/zh-tw.mjs'
|
||
|
|
export const ipoStore = defineStore({
|
||
|
|
id: 'app',
|
||
|
|
state: () => ({
|
||
|
|
//1代表英文 2代表繁体中文 3代表简体中文
|
||
|
|
locale:1
|
||
|
|
}),
|
||
|
|
getters: {
|
||
|
|
localeLang(state) {
|
||
|
|
return [en,zhTw,zhCn][state.locale-1];
|
||
|
|
},
|
||
|
|
},
|
||
|
|
actions: {
|
||
|
|
//更改语言的方法
|
||
|
|
setLocale(data: number) {
|
||
|
|
this.locale = data
|
||
|
|
}
|
||
|
|
}
|
||
|
|
})
|