lxf
2025-07-11 2a95677853ec636b4c568d0045a8bb1d4ef13097
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<template>
  <div class="lang">
    <fx-header>
      <template #title>
        {{ $t('setLanguage') }}
      </template>
    </fx-header>
    <div v-for="(item, index) in lang" :key="index" class="lang-padding" @click="handleSetLang(item.key,item.title)">
      <div class="lang-title flex items-center font-13 textColor">
        <img class="h-6 mr-3" :src="item.image" alt="">
        {{ item.title }}
      </div>
      <div class="lang-flex"></div>
      <img v-if="item.key == locale" src="../../assets/image/public/checked.png" style="width: 20px;height: 20px;" />
    </div>
  </div>
</template>
<script setup>
import { ref, onMounted } from "vue";
import { useI18n } from "vue-i18n";
import { SET_LANGUAGE } from '@/store/types.store'
import { useLanguageStore } from '@/store/language.store'
const { locale, t } = useI18n()
 
const languageStore = useLanguageStore()
 
let lang = ref([
  { title: '繁体中文', key: 'CN', image: new URL('../../assets/image/lang/taiwan.png', import.meta.url) },
  // { title: '简体中文', key: 'zh-CN', image: new URL('../../assets/image/lang/zh-CN.png', import.meta.url) },
  { title: 'English', key: 'en', image: new URL('../../assets/image/lang/en-US.png', import.meta.url) },
  { title: '한국인', key: 'Korean', image: new URL('../../assets/image/lang/Korean.png', import.meta.url) },
  { title: 'やまと', key: 'Japanese', image: new URL('../../assets/image/lang/Japanese.png', import.meta.url) },
  { title: 'Deutsch', key: 'de', image: new URL('../../assets/image/lang/de.png', import.meta.url) }, //德语
  { title: 'Français', key: 'fr', image: new URL('../../assets/image/lang/French.png', import.meta.url) }, //法语
  // { title: 'Tiếng Việt', key: 'vi', image: new URL('../../assets/image/lang/vi.png', import.meta.url) },//越南语
  // { title: 'Italiano', key: 'Italy', image: new URL('../../assets/image/lang/Italy.png', import.meta.url) }, //意大利语
  // { title: 'ไทย', key: 'th', image: new URL('../../assets/image/lang/Thai.png', import.meta.url) }, //泰语
 
])
 
onMounted(() => {
  console.log(locale.value)
})
const handleSetLang = (lang, tit) => {
  locale.value = lang
  languageStore[SET_LANGUAGE](lang,tit)
}
 
</script>
<style lang="scss" scoped>
.lang {
  width: 100%;
  box-sizing: border-box;
}
 
.CommonProblem-padding {
  padding-left: 25px;
  padding-right: 25px;
}
 
.lang-padding {
  padding: 15px 18px 22px 18px;
  box-sizing: border-box;
  border-bottom: 1px solid $border_color;
  font-weight: 400;
  font-size: 18px;
  color: $text_color;
  display: flex;
}
 
.lang-flex {
  flex: 1;
}
</style>