perf(web): 按实际使用注册界面组件以缩小入口包
This commit is contained in:
1 parent
81c96eebaf
commit
ff55c95ea0
2 files changed
+131
-3
No files matched your search
@@ -0,0 +1,129 @@
|
|||||||
|
import type { App } from 'vue';
|
||||||
|
import {
|
||||||
|
ElAlert,
|
||||||
|
ElAside,
|
||||||
|
ElBreadcrumb,
|
||||||
|
ElBreadcrumbItem,
|
||||||
|
ElButton,
|
||||||
|
ElCard,
|
||||||
|
ElCheckbox,
|
||||||
|
ElCheckboxGroup,
|
||||||
|
ElCol,
|
||||||
|
ElContainer,
|
||||||
|
ElDatePicker,
|
||||||
|
ElDescriptions,
|
||||||
|
ElDescriptionsItem,
|
||||||
|
ElDialog,
|
||||||
|
ElDivider,
|
||||||
|
ElDrawer,
|
||||||
|
ElDropdown,
|
||||||
|
ElDropdownItem,
|
||||||
|
ElDropdownMenu,
|
||||||
|
ElEmpty,
|
||||||
|
ElForm,
|
||||||
|
ElFormItem,
|
||||||
|
ElHeader,
|
||||||
|
ElIcon,
|
||||||
|
ElInput,
|
||||||
|
ElInputNumber,
|
||||||
|
ElLink,
|
||||||
|
ElLoading,
|
||||||
|
ElMain,
|
||||||
|
ElMenu,
|
||||||
|
ElMenuItem,
|
||||||
|
ElOption,
|
||||||
|
ElOptionGroup,
|
||||||
|
ElPagination,
|
||||||
|
ElPopover,
|
||||||
|
ElProgress,
|
||||||
|
ElRadio,
|
||||||
|
ElRadioButton,
|
||||||
|
ElRadioGroup,
|
||||||
|
ElResult,
|
||||||
|
ElRow,
|
||||||
|
ElSelect,
|
||||||
|
ElSlider,
|
||||||
|
ElStep,
|
||||||
|
ElSteps,
|
||||||
|
ElSubMenu,
|
||||||
|
ElSwitch,
|
||||||
|
ElTabPane,
|
||||||
|
ElTable,
|
||||||
|
ElTableColumn,
|
||||||
|
ElTabs,
|
||||||
|
ElTag,
|
||||||
|
ElText,
|
||||||
|
ElTimeSelect,
|
||||||
|
ElTooltip,
|
||||||
|
ElTour,
|
||||||
|
ElTourStep,
|
||||||
|
ElUpload,
|
||||||
|
provideGlobalConfig,
|
||||||
|
} from 'element-plus';
|
||||||
|
import zhCn from 'element-plus/es/locale/lang/zh-cn';
|
||||||
|
|
||||||
|
/** 按模板实际使用注册组件;完整主题样式仍由入口加载。 */
|
||||||
|
export function registerElementPlus(app: App): void {
|
||||||
|
for (const component of [
|
||||||
|
ElAlert,
|
||||||
|
ElAside,
|
||||||
|
ElBreadcrumb,
|
||||||
|
ElBreadcrumbItem,
|
||||||
|
ElButton,
|
||||||
|
ElCard,
|
||||||
|
ElCheckbox,
|
||||||
|
ElCheckboxGroup,
|
||||||
|
ElCol,
|
||||||
|
ElContainer,
|
||||||
|
ElDatePicker,
|
||||||
|
ElDescriptions,
|
||||||
|
ElDescriptionsItem,
|
||||||
|
ElDialog,
|
||||||
|
ElDivider,
|
||||||
|
ElDrawer,
|
||||||
|
ElDropdown,
|
||||||
|
ElDropdownItem,
|
||||||
|
ElDropdownMenu,
|
||||||
|
ElEmpty,
|
||||||
|
ElForm,
|
||||||
|
ElFormItem,
|
||||||
|
ElHeader,
|
||||||
|
ElIcon,
|
||||||
|
ElInput,
|
||||||
|
ElInputNumber,
|
||||||
|
ElLink,
|
||||||
|
ElLoading,
|
||||||
|
ElMain,
|
||||||
|
ElMenu,
|
||||||
|
ElMenuItem,
|
||||||
|
ElOption,
|
||||||
|
ElOptionGroup,
|
||||||
|
ElPagination,
|
||||||
|
ElPopover,
|
||||||
|
ElProgress,
|
||||||
|
ElRadio,
|
||||||
|
ElRadioButton,
|
||||||
|
ElRadioGroup,
|
||||||
|
ElResult,
|
||||||
|
ElRow,
|
||||||
|
ElSelect,
|
||||||
|
ElSlider,
|
||||||
|
ElStep,
|
||||||
|
ElSteps,
|
||||||
|
ElSubMenu,
|
||||||
|
ElSwitch,
|
||||||
|
ElTabPane,
|
||||||
|
ElTable,
|
||||||
|
ElTableColumn,
|
||||||
|
ElTabs,
|
||||||
|
ElTag,
|
||||||
|
ElText,
|
||||||
|
ElTimeSelect,
|
||||||
|
ElTooltip,
|
||||||
|
ElTour,
|
||||||
|
ElTourStep,
|
||||||
|
ElUpload,
|
||||||
|
])
|
||||||
|
app.use(component);
|
||||||
|
provideGlobalConfig({ locale: zhCn }, app, true);
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue';
|
||||||
import { createPinia } from 'pinia';
|
import { createPinia } from 'pinia';
|
||||||
import ElementPlus from 'element-plus';
|
import { registerElementPlus } from './element-plus';
|
||||||
import zhCn from 'element-plus/es/locale/lang/zh-cn';
|
|
||||||
import 'element-plus/dist/index.css';
|
import 'element-plus/dist/index.css';
|
||||||
// 深色主题:html.dark 下的 --el-* 变量(品牌侧的语义色覆盖在 styles/index.css 的 html.dark 块)
|
// 深色主题:html.dark 下的 --el-* 变量(品牌侧的语义色覆盖在 styles/index.css 的 html.dark 块)
|
||||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||||
@@ -21,7 +20,7 @@ registerAppIcons(app);
|
|||||||
|
|
||||||
app.use(pinia);
|
app.use(pinia);
|
||||||
app.use(router);
|
app.use(router);
|
||||||
app.use(ElementPlus, { locale: zhCn });
|
registerElementPlus(app);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全局错误处理。
|
* 全局错误处理。
|
||||||
|
|||||||
Reference in new issue
Block a user