<template>
<el-config-provider :locale="currentLocale">
<router-view />
</el-config-provider>
</template>
<script lang="ts">
import { ElConfigProvider } from "element-plus";
import zhCn from "element-plus/lib/locale/lang/zh-cn";
import en from "element-plus/lib/locale/lang/en";
export default {
name: "app",
components: {
[ElConfigProvider.name]: ElConfigProvider
},
computed: {
currentLocale() {
switch (this.$storage.locale?.locale) {
case "zh":
return zhCn;
case "en":
return en;
}
}
}
};
</script>
vue3读取本地国际化语言
最新推荐文章于 2024-06-18 21:53:51 发布