Trim startup Element Plus locale imports

This commit is contained in:
2026-06-09 13:14:04 +08:00
parent 99110d6c3a
commit 5566576333
2 changed files with 6 additions and 8 deletions
+6 -4
View File
@@ -15,9 +15,7 @@ import {
import { preferences } from '@vben/preferences'; import { preferences } from '@vben/preferences';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import enLocale from 'element-plus/es/locale/lang/en';
import defaultLocale from 'element-plus/es/locale/lang/zh-cn'; import defaultLocale from 'element-plus/es/locale/lang/zh-cn';
import zhTwLocale from 'element-plus/es/locale/lang/zh-tw';
const elementLocale = ref<Language>(defaultLocale); const elementLocale = ref<Language>(defaultLocale);
@@ -108,7 +106,9 @@ async function loadDayjsLocale(lang: SupportedLanguagesType) {
async function loadElementLocale(lang: SupportedLanguagesType) { async function loadElementLocale(lang: SupportedLanguagesType) {
switch (lang) { switch (lang) {
case 'en-US': { case 'en-US': {
elementLocale.value = enLocale; elementLocale.value = (
await import('element-plus/es/locale/lang/en')
).default;
break; break;
} }
case 'zh-CN': { case 'zh-CN': {
@@ -116,7 +116,9 @@ async function loadElementLocale(lang: SupportedLanguagesType) {
break; break;
} }
case 'zh-TW': { case 'zh-TW': {
elementLocale.value = zhTwLocale; elementLocale.value = (
await import('element-plus/es/locale/lang/zh-tw')
).default;
break; break;
} }
} }
@@ -29,10 +29,6 @@ const asyncComponents: Record<string, ElementComponentLoader> = {
import('element-plus/es/components/checkbox/index').then( import('element-plus/es/components/checkbox/index').then(
(m) => m.ElCheckbox, (m) => m.ElCheckbox,
), ),
ElConfigProvider: () =>
import('element-plus/es/components/config-provider/index').then(
(m) => m.ElConfigProvider,
),
ElDescriptions: () => ElDescriptions: () =>
import('element-plus/es/components/descriptions/index').then( import('element-plus/es/components/descriptions/index').then(
(m) => m.ElDescriptions, (m) => m.ElDescriptions,