diff --git a/build/plugins/auto-import.ts b/build/plugins/auto-import.ts index d1937fc87..eb4c02985 100644 --- a/build/plugins/auto-import.ts +++ b/build/plugins/auto-import.ts @@ -1,6 +1,7 @@ import Icons from 'unplugin-icons/vite'; import IconsResolver from 'unplugin-icons/resolver'; import Components from 'unplugin-vue-components/vite'; +import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'; import { FileSystemIconLoader } from 'unplugin-icons/loaders'; export default (srcPath: string) => { @@ -15,7 +16,7 @@ export default (srcPath: string) => { }), Components({ dts: true, - resolvers: [IconsResolver({ customCollections: ['custom'], componentPrefix: 'icon' })] + resolvers: [NaiveUiResolver(), IconsResolver({ customCollections: ['custom'], componentPrefix: 'icon' })] }) ]; }; diff --git a/components.d.ts b/components.d.ts index e0b6694e9..01abe2188 100644 --- a/components.d.ts +++ b/components.d.ts @@ -13,9 +13,17 @@ declare module 'vue' { IconAntDesignCloseOutlined: typeof import('~icons/ant-design/close-outlined')['default'] IconAntDesignEnterOutlined: typeof import('~icons/ant-design/enter-outlined')['default'] IconAntDesignSettingOutlined: typeof import('~icons/ant-design/setting-outlined')['default'] + IconCustomActivity: typeof import('~icons/custom/activity')['default'] IconCustomAvatar: typeof import('~icons/custom/avatar')['default'] + IconCustomBanner: typeof import('~icons/custom/banner')['default'] + IconCustomCast: typeof import('~icons/custom/cast')['default'] + IconCustomEmptyData: typeof import('~icons/custom/empty-data')['default'] IconCustomLogo: typeof import('~icons/custom/logo')['default'] IconCustomLogoFill: typeof import('~icons/custom/logo-fill')['default'] + IconCustomNetworkError: typeof import('~icons/custom/network-error')['default'] + IconCustomNoPermission: typeof import('~icons/custom/no-permission')['default'] + IconCustomNotFound: typeof import('~icons/custom/not-found')['default'] + IconCustomServiceError: typeof import('~icons/custom/service-error')['default'] IconGridiconsFullscreen: typeof import('~icons/gridicons/fullscreen')['default'] IconGridiconsFullscreenExit: typeof import('~icons/gridicons/fullscreen-exit')['default'] IconIcOutlineCheck: typeof import('~icons/ic/outline-check')['default'] @@ -29,6 +37,7 @@ declare module 'vue' { IconMdiPin: typeof import('~icons/mdi/pin')['default'] IconMdiPinOff: typeof import('~icons/mdi/pin-off')['default'] IconMdiRefresh: typeof import('~icons/mdi/refresh')['default'] + IconMdiWechat: typeof import('~icons/mdi/wechat')['default'] IconMdiWhiteBalanceSunny: typeof import('~icons/mdi/white-balance-sunny')['default'] IconPhCaretDoubleLeftBold: typeof import('~icons/ph/caret-double-left-bold')['default'] IconPhCaretDoubleRightBold: typeof import('~icons/ph/caret-double-right-bold')['default'] @@ -38,6 +47,51 @@ declare module 'vue' { LoadingEmptyWrapper: typeof import('./src/components/business/LoadingEmptyWrapper.vue')['default'] LoginAgreement: typeof import('./src/components/business/LoginAgreement.vue')['default'] NaiveProvider: typeof import('./src/components/common/NaiveProvider.vue')['default'] + NBreadcrumb: typeof import('naive-ui')['NBreadcrumb'] + NBreadcrumbItem: typeof import('naive-ui')['NBreadcrumbItem'] + NButton: typeof import('naive-ui')['NButton'] + NCard: typeof import('naive-ui')['NCard'] + NCheckbox: typeof import('naive-ui')['NCheckbox'] + NColorPicker: typeof import('naive-ui')['NColorPicker'] + NConfigProvider: typeof import('naive-ui')['NConfigProvider'] + NDataTable: typeof import('naive-ui')['NDataTable'] + NDescriptions: typeof import('naive-ui')['NDescriptions'] + NDescriptionsItem: typeof import('naive-ui')['NDescriptionsItem'] + NDialogProvider: typeof import('naive-ui')['NDialogProvider'] + NDivider: typeof import('naive-ui')['NDivider'] + NDrawer: typeof import('naive-ui')['NDrawer'] + NDrawerContent: typeof import('naive-ui')['NDrawerContent'] + NDropdown: typeof import('naive-ui')['NDropdown'] + NEmpty: typeof import('naive-ui')['NEmpty'] + NForm: typeof import('naive-ui')['NForm'] + NFormItem: typeof import('naive-ui')['NFormItem'] + NGradientText: typeof import('naive-ui')['NGradientText'] + NGrid: typeof import('naive-ui')['NGrid'] + NGridItem: typeof import('naive-ui')['NGridItem'] + NInput: typeof import('naive-ui')['NInput'] + NInputGroup: typeof import('naive-ui')['NInputGroup'] + NInputNumber: typeof import('naive-ui')['NInputNumber'] + NList: typeof import('naive-ui')['NList'] + NListItem: typeof import('naive-ui')['NListItem'] + NLoadingBarProvider: typeof import('naive-ui')['NLoadingBarProvider'] + NMenu: typeof import('naive-ui')['NMenu'] + NMessageProvider: typeof import('naive-ui')['NMessageProvider'] + NModal: typeof import('naive-ui')['NModal'] + NNotificationProvider: typeof import('naive-ui')['NNotificationProvider'] + NPopover: typeof import('naive-ui')['NPopover'] + NScrollbar: typeof import('naive-ui')['NScrollbar'] + NSelect: typeof import('naive-ui')['NSelect'] + NSpace: typeof import('naive-ui')['NSpace'] + NSpin: typeof import('naive-ui')['NSpin'] + NStatistic: typeof import('naive-ui')['NStatistic'] + NSwitch: typeof import('naive-ui')['NSwitch'] + NTabPane: typeof import('naive-ui')['NTabPane'] + NTabs: typeof import('naive-ui')['NTabs'] + NTag: typeof import('naive-ui')['NTag'] + NThing: typeof import('naive-ui')['NThing'] + NTimeline: typeof import('naive-ui')['NTimeline'] + NTimelineItem: typeof import('naive-ui')['NTimelineItem'] + NTooltip: typeof import('naive-ui')['NTooltip'] SystemLogo: typeof import('./src/components/common/SystemLogo.vue')['default'] WebSiteLink: typeof import('./src/components/custom/WebSiteLink.vue')['default'] } diff --git a/src/main.ts b/src/main.ts index 1955649e2..70c5a672e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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); diff --git a/src/plugins/index.ts b/src/plugins/index.ts index 18628336b..4de580b26 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -1,4 +1,3 @@ import setupAssets from './assets'; -import setupNaiveUI from './naive'; -export { setupAssets, setupNaiveUI }; +export { setupAssets }; diff --git a/src/plugins/naive.ts b/src/plugins/naive.ts deleted file mode 100644 index cb8399596..000000000 --- a/src/plugins/naive.ts +++ /dev/null @@ -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); -}