From 90ad4431784a97506a826ebf203ac5fa1a995488 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Wed, 24 Jan 2024 11:49:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9elementplus=20=E8=AF=AD?= =?UTF-8?q?=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/admin/support/catchAdmin.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/resources/admin/support/catchAdmin.ts b/resources/admin/support/catchAdmin.ts index 1d41492..1e58dae 100644 --- a/resources/admin/support/catchAdmin.ts +++ b/resources/admin/support/catchAdmin.ts @@ -4,11 +4,14 @@ import App from '/admin/App.vue' import router, { bootstrapRouter } from '/admin/router' import ElementPlus from 'element-plus' import zh from 'element-plus/es/locale/lang/zh-cn' +import en from 'element-plus/es/locale/lang/en' + import { bootstrapStore } from '/admin/stores' import Cache from './cache' import { bootstrapI18n } from '/admin/i18n' import guard from '/admin/router/guard' import { bootstrapDirectives } from '/admin/directives' +import { Language } from 'element-plus/es/locale' /** * catchadmin @@ -63,9 +66,14 @@ export default class CatchAdmin { * @returns */ protected useElementPlus(): CatchAdmin { - // @ts-ignore + // @ts-ignore + const languages = { + zh, en + } + + const language = Cache.get('language') || 'zh' this.app.use(ElementPlus, { - locale: Cache.get('language') === 'zh' || zh, + locale: languages[language] }) return this }