fix: 修改语言获取位置

This commit is contained in:
mtruning 2022-01-09 21:35:46 +08:00
parent 39ab04e051
commit caadad501f
5 changed files with 18 additions and 19 deletions

View File

@ -15,7 +15,7 @@
<script lang="ts" setup>
import { useLangStore } from '@/store/modules/langStore/langStore'
import { langList } from '@/settings/designSetting'
import { langList } from '@/i18n/index'
import { LangEnum } from '@/enums/styleEnum'
import { icon } from '@/plugins'

View File

@ -3,18 +3,32 @@ import { lang } from '@/settings/designSetting'
import { createI18n } from 'vue-i18n' //引入vue-i18n组件
import { getLocalStorage } from '@/utils'
import { StorageEnum }from '@/enums/storageEnum'
import { LangEnum } from '@/enums/styleEnum'
import { LangStateType } from '@/store/modules/langStore/langStore.d'
import zh from './zh/index'
import en from './en/index'
const langStorage: LangStateType = getLocalStorage(StorageEnum.GO_LANG_STORE)
// 语言数组
export const langList = [
{
label: '中文',
key: LangEnum.zh
},
{
label: 'English',
key: LangEnum.en
}
]
const i18n = createI18n({
locale: langStorage?.lang || lang,
globalInjection: true,
messages: {
zh: zh,
en: en
[LangEnum.zh]: zh,
[LangEnum.en]: en
}
})

View File

@ -3,18 +3,6 @@ import { LangEnum } from '@/enums/styleEnum'
// 默认语言
export const lang = LangEnum.zh
// 语言数组
export const langList = [
{
label: '中文',
key: LangEnum.zh
},
{
label: 'English',
key: LangEnum.en
}
]
// 主体色
export const appThemeList: string[] = [
'#2d8cf0',

View File

@ -1,4 +0,0 @@
export const GO_LOGIN_STORE = 'GO-ACCESS-TOKEN' // 登录信息
export const GO_LANG_STORE = 'GO-LANG' // 语言
export const GO_DESIGN_STORE = 'GO-DESIGN' // 当前选择的主题
export const GO_CHART_LAYOUT_STORE = 'GO-Chart-Layout-Store' // 拖拽页面

View File

@ -102,6 +102,7 @@ const emit = defineEmits(['delete', 'resize', 'edit'])
const t = window['$t']
const props = defineProps({
// todo ITEN type
cardData: Object
})
const fnBtnList = reactive([