mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-06-08 01:17:23 +08:00
fix: element-plus locale config
This commit is contained in:
parent
b87183cb75
commit
1687097e63
33
src/App.vue
33
src/App.vue
@ -1,25 +1,28 @@
|
|||||||
<script setup lang="ts">
|
<template>
|
||||||
import { getCurrentInstance } from "vue";
|
<el-config-provider :locale="currentLocale">
|
||||||
|
<router-view />
|
||||||
|
</el-config-provider>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
import { ElConfigProvider } from "element-plus";
|
import { ElConfigProvider } from "element-plus";
|
||||||
import zhCn from "element-plus/lib/locale/lang/zh-cn";
|
import zhCn from "element-plus/lib/locale/lang/zh-cn";
|
||||||
import en from "element-plus/lib/locale/lang/en";
|
import en from "element-plus/lib/locale/lang/en";
|
||||||
|
export default {
|
||||||
let locale: string =
|
name: "app",
|
||||||
getCurrentInstance().appContext.config.globalProperties.$storage?.locale
|
components: {
|
||||||
?.locale;
|
[ElConfigProvider.name]: ElConfigProvider
|
||||||
|
},
|
||||||
let currentLocale = () => {
|
computed: {
|
||||||
switch (locale) {
|
// eslint-disable-next-line vue/return-in-computed-property
|
||||||
|
currentLocale() {
|
||||||
|
switch (this.$storage.locale?.locale) {
|
||||||
case "zh":
|
case "zh":
|
||||||
return zhCn;
|
return zhCn;
|
||||||
case "en":
|
case "en":
|
||||||
return en;
|
return en;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
|
||||||
<el-config-provider :locale="currentLocale()">
|
|
||||||
<router-view />
|
|
||||||
</el-config-provider>
|
|
||||||
</template>
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user