|
@@ -1,6 +1,5 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import { languageList } from '@/constant/languageList'
|
|
|
|
|
-
|
|
|
|
|
|
|
+import { getI18nList } from '@/api/modules/anycallService'
|
|
|
|
|
|
|
|
// 定义组件属性
|
|
// 定义组件属性
|
|
|
interface Props {
|
|
interface Props {
|
|
@@ -39,10 +38,30 @@ watch(
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
-const options = ref<Array<{value: string, name: string}>>(languageList.map(item => ({
|
|
|
|
|
- value: item.countryCode,
|
|
|
|
|
- name: item.chineseName
|
|
|
|
|
-})))
|
|
|
|
|
|
|
+const options = ref<Array<{value: string, name: string}>>([])
|
|
|
|
|
+
|
|
|
|
|
+const fetchData = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await getI18nList()
|
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
|
+ console.log(res.data,3333)
|
|
|
|
|
+ options.value = res.data
|
|
|
|
|
+ // // 将API返回的数据转换为select需要的格式
|
|
|
|
|
+ // options.value = res.data.content.map((item: any) => ({
|
|
|
|
|
+ // value: item.id,
|
|
|
|
|
+ // name: item.name
|
|
|
|
|
+ // }))
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.error('获取 I18n 失败:', res.msg)
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('获取 I18n 失败:', error)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+onMounted(() => {
|
|
|
|
|
+ fetchData()
|
|
|
|
|
+})
|
|
|
|
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|