You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

26 lines
720 B

<template>
<el-config-provider :locale="elLocale">
<router-view />
</el-config-provider>
</template>
<script setup>
import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
// 引入 Element Plus 的语言包
import zhCnLocale from 'element-plus/dist/locale/zh-cn.mjs'
import enLocale from 'element-plus/dist/locale/en.mjs'
import thLocale from 'element-plus/dist/locale/th.mjs'
const { locale } = useI18n()
// 计算属性:根据当前 i18n 的语言,返回对应的 Element Plus 语言包
const elLocale = computed(() => {
switch (locale.value) {
case 'zh-CN': return zhCnLocale
case 'en': return enLocale
case 'th': return thLocale
default: return zhCnLocale
}
})
</script>