mirror of
https://gitee.com/yiming_chang/vue-pure-admin.git
synced 2024-12-02 11:17:39 +08:00
fix: i18n bug in production
This commit is contained in:
parent
7ed66b321d
commit
f0e780c48f
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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: {
|
||||
|
Loading…
Reference in New Issue
Block a user