feat: element plus UI组件库

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
sophieandCursor committed 2026-10-14 20:25:35 +08:00
1 parent 041bb73b9a
commit 5f6fbcd76f
30 files changed
+3621 -1327

No files matched your search

@@ -0,0 +1,35 @@
/**
* features/admin/composables/useElementProvider.ts
* 用途:管理端 Element Plus 试点的界面语言。
* 依赖:element-plus locale、vue-i18n。
* 逻辑:UsersPage、AgentsPage、KbAdminPanel 把 elementLocale 传给 ElConfigProvider;亮暗靠 html.dark 与 Element 暗色变量,不在这里重复切换。
*/
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
import zhCn from 'element-plus/es/locale/lang/zh-cn';
import zhTw from 'element-plus/es/locale/lang/zh-tw';
import en from 'element-plus/es/locale/lang/en';
import th from 'element-plus/es/locale/lang/th';
const ELEMENT_LOCALES = {
'zh-CN': zhCn,
'zh-TW': zhTw,
en,
th,
} as const;
/**
* 取当前界面语言对应的 Element Plus 语言包。
* 核心逻辑:未知语言回退简体中文。
* @returns elementLocale,随 vue-i18n 语言变化
*/
export function useElementProvider() {
const { locale } = useI18n();
const elementLocale = computed(() => {
const key = locale.value as keyof typeof ELEMENT_LOCALES;
return ELEMENT_LOCALES[key] ?? zhCn;
});
return { elementLocale };
}