fix: i18n bug in production

This commit is contained in:
xiaoxian521 2021-05-07 23:17:15 +08:00
parent 7ed66b321d
commit f0e780c48f
3 changed files with 8 additions and 5 deletions

View File

@ -55,7 +55,8 @@ import favicon from "/favicon.ico";
import { emitter } from "/@/utils/mitt";
import { deviceDetection } from "/@/utils/deviceDetection";
import { useI18n } from "vue-i18n";
import { locale as eleplusLocale } from "element-plus";
import ElementLocale from "element-plus/lib/locale";
import enLocale from "element-plus/lib/locale/lang/en";
import zhLocale from "element-plus/lib/locale/lang/zh-cn";
@ -82,10 +83,10 @@ export default defineComponent({
langs.value = !langs.value;
if (langs.value) {
locale.value = "zh";
eleplusLocale(zhLocale);
ElementLocale.use(zhLocale);
} else {
locale.value = "en";
eleplusLocale(enLocale);
ElementLocale.use(enLocale);
}
};

View File

@ -62,6 +62,10 @@ const components = [
const plugins = [ElLoading];
import ElementLocale from "element-plus/lib/locale";
import zhLocale from "element-plus/lib/locale/lang/zh-cn";
ElementLocale.use(zhLocale);
export function useElementPlus(app: App) {
components.forEach((component) => {
app.component(component.name, component);

View File

@ -4,10 +4,8 @@ import zhVxeTable from "vxe-table/lib/locale/lang/zh-CN";
import enVxeTable from "vxe-table/lib/locale/lang/en-US";
// element-plus国际化
import { locale } from "element-plus";
import enLocale from "element-plus/lib/locale/lang/en";
import zhLocale from "element-plus/lib/locale/lang/zh-cn";
locale(zhLocale);
export const menusConfig = {
zh: {