feat(projects): 插件方式按需引入naiveUI

This commit is contained in:
Soybean
2022-04-04 17:41:08 +08:00
parent 3fb13ca9e7
commit 6bed9ead38
5 changed files with 58 additions and 110 deletions

View File

@ -1,5 +1,5 @@
import { createApp } from 'vue';
import { setupAssets, setupNaiveUI } from '@/plugins';
import { setupAssets } from '@/plugins';
import { setupRouter } from '@/router';
import { setupStore } from '@/store';
import { setupDirectives } from '@/directives';
@ -17,9 +17,6 @@ async function setupApp() {
// 挂载自定义vue指令
setupDirectives(app);
// 按需引入naiveUI
setupNaiveUI(app);
// 挂载路由
await setupRouter(app);

View File

@ -1,4 +1,3 @@
import setupAssets from './assets';
import setupNaiveUI from './naive';
export { setupAssets, setupNaiveUI };
export { setupAssets };

View File

@ -1,103 +0,0 @@
import type { App } from 'vue';
import {
create,
NBreadcrumb,
NBreadcrumbItem,
NButton,
NCard,
NCheckbox,
NColorPicker,
NConfigProvider,
NDataTable,
NDescriptions,
NDescriptionsItem,
NDialogProvider,
NDivider,
NDrawer,
NDrawerContent,
NDropdown,
NEmpty,
NForm,
NFormItem,
NGradientText,
NGrid,
NGridItem,
NInput,
NInputGroup,
NInputNumber,
NList,
NListItem,
NLoadingBarProvider,
NModal,
NMenu,
NMessageProvider,
NNotificationProvider,
NPopover,
NScrollbar,
NSelect,
NSpace,
NStatistic,
NSwitch,
NSpin,
NTabs,
NTabPane,
NTag,
NThing,
NTimeline,
NTimelineItem,
NTooltip
} from 'naive-ui';
/** 按需引入naiveUI */
export default function setupNaiveUI(app: App) {
const naive = create({
components: [
NBreadcrumb,
NBreadcrumbItem,
NButton,
NCard,
NCheckbox,
NColorPicker,
NConfigProvider,
NDataTable,
NDescriptions,
NDescriptionsItem,
NDialogProvider,
NDivider,
NDrawer,
NDrawerContent,
NDropdown,
NEmpty,
NForm,
NFormItem,
NGradientText,
NGrid,
NGridItem,
NInput,
NInputGroup,
NInputNumber,
NList,
NListItem,
NLoadingBarProvider,
NModal,
NMenu,
NMessageProvider,
NNotificationProvider,
NPopover,
NScrollbar,
NSelect,
NSpace,
NStatistic,
NSwitch,
NSpin,
NTabs,
NTabPane,
NTag,
NThing,
NTimeline,
NTimelineItem,
NTooltip
]
});
app.use(naive);
}