From f5a043b11a403927828ae922bdae411a4e5ae3c6 Mon Sep 17 00:00:00 2001 From: Soybean Date: Sat, 12 Mar 2022 19:55:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(projects):=20=E6=B7=BB=E5=8A=A0=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E7=BB=84=E4=BB=B6=E8=87=AA=E5=8A=A8=E5=BC=95=E5=85=A5?= =?UTF-8?q?=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/plugins/auto-import.ts | 21 ++++++++ build/plugins/iconify.ts | 2 +- build/plugins/index.ts | 4 +- components.d.ts | 48 +++++++++++++++++++ src/App.vue | 1 - src/layouts/common/GlobalFooter/index.vue | 4 +- .../GlobalHeader/components/FullScreen.vue | 1 - .../GlobalHeader/components/GithubSite.vue | 4 +- .../GlobalHeader/components/MenuCollapse.vue | 1 - .../GlobalHeader/components/ThemeMode.vue | 1 - .../GlobalHeader/components/UserAvatar.vue | 1 - src/layouts/common/GlobalHeader/index.vue | 1 - src/layouts/common/GlobalLogo/index.vue | 1 - src/layouts/common/GlobalSearch/index.vue | 1 - .../components/MixMenuDrawer.vue | 1 - .../components/VerticalMixSider/index.vue | 1 - .../components/VerticalSider/index.vue | 1 - .../components/ReloadButton/index.vue | 1 - src/layouts/common/GlobalTab/index.vue | 1 - src/views/component/table/index.vue | 1 - .../analysis/components/DataCard/index.vue | 1 - .../analysis/components/TopChart/index.vue | 1 - src/views/plugin/editor/markdown/index.vue | 1 - src/views/plugin/editor/quill/index.vue | 1 - src/views/plugin/icon/index.vue | 1 - src/views/plugin/print/index.vue | 1 - src/views/plugin/swiper/index.vue | 1 - .../login/components/CodeLogin/index.vue | 1 - .../login/components/Register/index.vue | 1 - src/views/system-view/login/index.vue | 1 - tsconfig.json | 3 +- vite.config.ts | 2 +- 32 files changed, 77 insertions(+), 35 deletions(-) create mode 100644 build/plugins/auto-import.ts create mode 100644 components.d.ts diff --git a/build/plugins/auto-import.ts b/build/plugins/auto-import.ts new file mode 100644 index 000000000..29fb19830 --- /dev/null +++ b/build/plugins/auto-import.ts @@ -0,0 +1,21 @@ +import Icons from 'unplugin-icons/vite'; +import IconsResolver from 'unplugin-icons/resolver'; +import Components from 'unplugin-vue-components/vite'; +import { FileSystemIconLoader } from 'unplugin-icons/loaders'; + +export default (srcPath: string) => { + return [ + Icons({ + compiler: 'vue3', + customCollections: { + custom: FileSystemIconLoader(`${srcPath}/assets/svg`), + }, + scale: 1, + defaultClass: 'inline-block', + }), + Components({ + dts: true, + resolvers: [IconsResolver({ customCollections: ['custom'], componentPrefix: 'icon' })], + }), + ]; +}; diff --git a/build/plugins/iconify.ts b/build/plugins/iconify.ts index 848760b2a..f7b73745a 100644 --- a/build/plugins/iconify.ts +++ b/build/plugins/iconify.ts @@ -14,7 +14,7 @@ export default (srcPath: string) => { defaultClass: 'inline-block', }), Components({ - dts: false, + dts: true, resolvers: [IconsResolver({ customCollections: ['custom'], componentPrefix: 'icon' })], }), ]; diff --git a/build/plugins/index.ts b/build/plugins/index.ts index b4e6799dc..41de2b833 100644 --- a/build/plugins/index.ts +++ b/build/plugins/index.ts @@ -1,7 +1,7 @@ import type { ConfigEnv, PluginOption } from 'vite'; import vue from './vue'; import html from './html'; -import iconify from './iconify'; +import autoImport from './auto-import'; import windicss from './windicss'; import mock from './mock'; import visualizer from './visualizer'; @@ -17,7 +17,7 @@ export function setupVitePlugins( srcPath: string, viteEnv: ImportMetaEnv ): (PluginOption | PluginOption[])[] { - const plugins = [vue, html(configEnv), ...iconify(srcPath), windicss, mock]; + const plugins = [vue, html(configEnv), ...autoImport(srcPath), windicss, mock]; if (configEnv.command === 'build' && viteEnv.VITE_VISUALIZER === 'true') { plugins.push(visualizer); diff --git a/components.d.ts b/components.d.ts new file mode 100644 index 000000000..21d647162 --- /dev/null +++ b/components.d.ts @@ -0,0 +1,48 @@ +// generated by unplugin-vue-components +// We suggest you to commit this file into source control +// Read more: https://github.com/vuejs/vue-next/pull/3399 + +declare module 'vue' { + export interface GlobalComponents { + BetterScroll: typeof import('./src/components/custom/BetterScroll.vue')['default']; + CountTo: typeof import('./src/components/custom/CountTo.vue')['default']; + DarkModeContainer: typeof import('./src/components/common/DarkModeContainer.vue')['default']; + DarkModeSwitch: typeof import('./src/components/common/DarkModeSwitch.vue')['default']; + GithubLink: typeof import('./src/components/custom/GithubLink.vue')['default']; + HoverContainer: typeof import('./src/components/common/HoverContainer.vue')['default']; + 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']; + IconCustomAvatar: typeof import('~icons/custom/avatar')['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']; + IconGridiconsFullscreen: typeof import('~icons/gridicons/fullscreen')['default']; + IconGridiconsFullscreenExit: typeof import('~icons/gridicons/fullscreen-exit')['default']; + IconIcOutlineCheck: typeof import('~icons/ic/outline-check')['default']; + IconLineMdMenuFoldLeft: typeof import('~icons/line-md/menu-fold-left')['default']; + IconLineMdMenuUnfoldLeft: typeof import('~icons/line-md/menu-unfold-left')['default']; + IconMdiArrowDownThin: typeof import('~icons/mdi/arrow-down-thin')['default']; + IconMdiArrowUpThin: typeof import('~icons/mdi/arrow-up-thin')['default']; + IconMdiClose: typeof import('~icons/mdi/close')['default']; + IconMdiGithub: typeof import('~icons/mdi/github')['default']; + IconMdiMoonWaningCrescent: typeof import('~icons/mdi/moon-waning-crescent')['default']; + IconMdiPin: typeof import('~icons/mdi/pin')['default']; + IconMdiPinOff: typeof import('~icons/mdi/pin-off')['default']; + IconMdiRefresh: typeof import('~icons/mdi/refresh')['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']; + IconSelect: typeof import('./src/components/custom/IconSelect.vue')['default']; + IconUilSearch: typeof import('~icons/uil/search')['default']; + ImageVerify: typeof import('./src/components/custom/ImageVerify.vue')['default']; + 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']; + SystemLogo: typeof import('./src/components/common/SystemLogo.vue')['default']; + WebSiteLink: typeof import('./src/components/custom/WebSiteLink.vue')['default']; + } +} + +export {}; diff --git a/src/App.vue b/src/App.vue index 49c5e0449..b4f319da2 100644 --- a/src/App.vue +++ b/src/App.vue @@ -14,7 +14,6 @@ + diff --git a/src/layouts/common/GlobalHeader/components/FullScreen.vue b/src/layouts/common/GlobalHeader/components/FullScreen.vue index 2618412cd..b72248f23 100644 --- a/src/layouts/common/GlobalHeader/components/FullScreen.vue +++ b/src/layouts/common/GlobalHeader/components/FullScreen.vue @@ -7,7 +7,6 @@ diff --git a/src/layouts/common/GlobalHeader/components/GithubSite.vue b/src/layouts/common/GlobalHeader/components/GithubSite.vue index e0992af91..0d567e80f 100644 --- a/src/layouts/common/GlobalHeader/components/GithubSite.vue +++ b/src/layouts/common/GlobalHeader/components/GithubSite.vue @@ -6,7 +6,5 @@ - + diff --git a/src/layouts/common/GlobalHeader/components/MenuCollapse.vue b/src/layouts/common/GlobalHeader/components/MenuCollapse.vue index 899993795..0e6758118 100644 --- a/src/layouts/common/GlobalHeader/components/MenuCollapse.vue +++ b/src/layouts/common/GlobalHeader/components/MenuCollapse.vue @@ -6,7 +6,6 @@