Przeglądaj źródła

fix: 修改语言获取位置

mtruning 3 lat temu
rodzic
commit
d5d5a72126

+ 1 - 1
src/components/LangSelect/index.vue

@@ -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'
 

+ 16 - 2
src/i18n/index.ts

@@ -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
   }
 })
 

+ 0 - 12
src/settings/designSetting.ts

@@ -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',

+ 0 - 4
src/settings/storageConst.ts

@@ -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' // 拖拽页面

+ 1 - 0
src/views/project/items/components/Card/index.vue

@@ -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([