diff --git a/build/plugin/index.js b/build/plugin/index.js index 1000d39..7e6fd03 100644 --- a/build/plugin/index.js +++ b/build/plugin/index.js @@ -6,20 +6,6 @@ import vue from '@vitejs/plugin-vue' */ import VueSetupExtend from 'vite-plugin-vue-setup-extend' -/** - * * 组件库按需引入插件 - * usage: 直接使用组件,无需在任何地方导入组件 - */ -import Components from 'unplugin-vue-components/vite' -import { NaiveUiResolver } from 'unplugin-vue-components/resolvers' - -/** - * * unplugin-icons插件,自动引入iconify图标 - * usage: https://github.com/antfu/unplugin-icons - * 图标库: https://icones.js.org/ - */ -import Icons from 'unplugin-icons/vite' - /** * * unocss插件,原子css * https://github.com/antfu/unocss @@ -31,20 +17,14 @@ import visualizer from 'rollup-plugin-visualizer' import { configHtmlPlugin } from './html' import { configMockPlugin } from './mock' +import unplugin from './unplugin' export function createVitePlugins(viteEnv, isBuild) { - const plugins = [ - vue(), - VueSetupExtend(), - Components({ - resolvers: [NaiveUiResolver()], - }), - Icons({ compiler: 'vue3', autoInstall: true }), - configHtmlPlugin(viteEnv, isBuild), - Unocss(), - ] + const plugins = [vue(), VueSetupExtend(), ...unplugin, configHtmlPlugin(viteEnv, isBuild), Unocss()] - viteEnv?.VITE_APP_USE_MOCK && plugins.push(configMockPlugin(isBuild)) + if (viteEnv?.VITE_APP_USE_MOCK) { + plugins.push(configMockPlugin(isBuild)) + } if (isBuild) { plugins.push( diff --git a/build/plugin/unplugin.js b/build/plugin/unplugin.js new file mode 100644 index 0000000..a433941 --- /dev/null +++ b/build/plugin/unplugin.js @@ -0,0 +1,28 @@ +import Components from 'unplugin-vue-components/vite' +import { NaiveUiResolver } from 'unplugin-vue-components/resolvers' +import { FileSystemIconLoader } from 'unplugin-icons/loaders' +import IconsResolver from 'unplugin-icons/resolver' + +/** + * * unplugin-icons插件,自动引入iconify图标 + * usage: https://github.com/antfu/unplugin-icons + * 图标库: https://icones.js.org/ + */ +import Icons from 'unplugin-icons/vite' + +import { getRootPath } from '../utils' + +const customIconPath = getRootPath('src', 'assets/icons') +export default [ + Icons({ + compiler: 'vue3', + customCollections: { + custom: FileSystemIconLoader(customIconPath), + }, + scale: 1, + defaultClass: 'inline-block', + }), + Components({ + resolvers: [NaiveUiResolver(), IconsResolver({ customCollections: ['custom'], componentPrefix: 'icon' })], + }), +] diff --git a/package.json b/package.json index efd86ff..3b991d4 100644 --- a/package.json +++ b/package.json @@ -21,10 +21,8 @@ "vue-router": "^4.0.15" }, "devDependencies": { - "@iconify-json/ant-design": "^1.1.1", - "@iconify-json/ic": "^1.1.2", - "@iconify-json/mdi": "^1.1.9", - "@iconify-json/simple-icons": "^1.1.7", + "@iconify/json": "^2.1.63", + "@iconify/vue": "^3.2.1", "@vitejs/plugin-vue": "^1.10.2", "@vue/compiler-sfc": "^3.2.31", "chalk": "^5.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 98325ea..fd0eef5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,10 +1,8 @@ lockfileVersion: 5.4 specifiers: - '@iconify-json/ant-design': ^1.1.1 - '@iconify-json/ic': ^1.1.2 - '@iconify-json/mdi': ^1.1.9 - '@iconify-json/simple-icons': ^1.1.7 + '@iconify/json': ^2.1.63 + '@iconify/vue': ^3.2.1 '@vitejs/plugin-vue': ^1.10.2 '@vue/compiler-sfc': ^3.2.31 '@vueuse/core': ^8.4.2 @@ -46,10 +44,8 @@ dependencies: vue-router: 4.0.15_vue@3.2.31 devDependencies: - '@iconify-json/ant-design': 1.1.1 - '@iconify-json/ic': 1.1.2 - '@iconify-json/mdi': 1.1.9 - '@iconify-json/simple-icons': 1.1.7 + '@iconify/json': 2.1.63 + '@iconify/vue': 3.2.1_vue@3.2.31 '@vitejs/plugin-vue': 1.10.2_vite@2.9.9 '@vue/compiler-sfc': 3.2.31 chalk: 5.0.1 @@ -152,28 +148,11 @@ packages: resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==} dev: true - /@iconify-json/ant-design/1.1.1: - resolution: {integrity: sha512-aziSNNmMGe/BpDVn+LCi7BP1hBJq39kn0j9yk4ZHqKGytiF9JRF/0ziKjxvo0BvYFuPAjwMVJpFzhG0KMZ/DGw==} - dependencies: - '@iconify/types': 1.1.0 - dev: true - - /@iconify-json/ic/1.1.2: - resolution: {integrity: sha512-OXLXNMECrwg1N7HqG9z+p8eF9NleoV5tZvIH/W3ip3HdZsg1VbEWl0RpI9K5VJjT95xVn2n+gcAgLPD5HNAsXg==} - dependencies: - '@iconify/types': 1.1.0 - dev: true - - /@iconify-json/mdi/1.1.9: - resolution: {integrity: sha512-iZY3d7nLmEhSxLU5YBHIxVVPySqNjj6zYcf448TXGBPp2PyToITCOuLEaub0rQ9jBAPOlupQsuPX9ylBfgIJ1w==} - dependencies: - '@iconify/types': 1.1.0 - dev: true - - /@iconify-json/simple-icons/1.1.7: - resolution: {integrity: sha512-VsDh1AlVTJ2GYBBRD8oUmhFrMj00pzmz8oGRrTAdu5sWYOyrJ9f0sFnr+89ABjAnzXqS8z2lmA0SxFG3HGQzvQ==} + /@iconify/json/2.1.63: + resolution: {integrity: sha512-WQwTV6KUl0C+VkH3/j9kwlHLOHyPn0pM7f0kFmJgghQ9Ha672UHr/KTuwVqbqn3c+RxnJyY+jIap4ewawMeaZA==} dependencies: '@iconify/types': 1.1.0 + pathe: 0.2.0 dev: true /@iconify/types/1.1.0: @@ -193,6 +172,14 @@ packages: - supports-color dev: true + /@iconify/vue/3.2.1_vue@3.2.31: + resolution: {integrity: sha512-c4R6ZgFo1JrJ8aPMMgOPgfU7lBswihMGR+yWe/P4ZukC3kTkeT4+lkt9Pc/itVFMkwva/S/7u9YofmYv57fnNQ==} + peerDependencies: + vue: 3.x + dependencies: + vue: 3.2.31 + dev: true + /@juggle/resize-observer/3.3.1: resolution: {integrity: sha512-zMM9Ds+SawiUkakS7y94Ymqx+S0ORzpG3frZirN3l+UlXUmSUR7hF4wxCVqW+ei94JzV5kt0uXBcoOEAuiydrw==} dev: true diff --git a/src/assets/images/logo.svg b/src/assets/icons/logo.svg similarity index 100% rename from src/assets/images/logo.svg rename to src/assets/icons/logo.svg diff --git a/src/components/AppIcons/IconLogo.vue b/src/components/AppIcons/IconLogo.vue deleted file mode 100644 index b53b067..0000000 --- a/src/components/AppIcons/IconLogo.vue +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/src/components/AppIcons/index.js b/src/components/AppIcons/index.js deleted file mode 100644 index f2f78d3..0000000 --- a/src/components/AppIcons/index.js +++ /dev/null @@ -1,26 +0,0 @@ -export { default as IconGitee } from '~icons/simple-icons/gitee' - -export { default as IconChart } from '~icons/mdi/chart-bar' -export { default as IconGithub } from '~icons/mdi/github' -export { default as IconVue } from '~icons/mdi/vuejs' -export { default as IconHome } from '~icons/mdi/home' -export { default as IconLink } from '~icons/mdi/link-variant' -export { default as IconAlert } from '~icons/mdi/alert-circle-outline' -export { default as IconCircle } from '~icons/mdi/circle-outline' -export { default as IconMenu } from '~icons/mdi/menu' -export { default as IconRefresh } from '~icons/mdi/refresh' -export { default as IconClose } from '~icons/mdi/close' -export { default as IconExpand } from '~icons/mdi/arrow-expand-horizontal' -export { default as IconExpandLeft } from '~icons/mdi/arrow-expand-left' -export { default as IconExpandRight } from '~icons/mdi/arrow-expand-right' -export { default as IconMenuTable } from '~icons/mdi/table' -export { default as IconMenuCollapse } from '~icons/mdi/format-indent-decrease' -export { default as IconMenuExpand } from '~icons/mdi/format-indent-increase' -export { default as IconExit } from '~icons/mdi/exit-to-app' - -export { default as IconFullscreen } from '~icons/ant-design/fullscreen-outlined' -export { default as IconFullscreenExit } from '~icons/ant-design/fullscreen-exit-outlined' -export { default as IconArrowLeft } from '~icons/ic/baseline-keyboard-arrow-left' -export { default as IconArrowRight } from '~icons/ic/baseline-keyboard-arrow-right' - -export { default as IconLogo } from './IconLogo.vue' diff --git a/src/components/Common/ScrollX.vue b/src/components/Common/ScrollX.vue index 9ba0807..6e7773c 100644 --- a/src/components/Common/ScrollX.vue +++ b/src/components/Common/ScrollX.vue @@ -2,10 +2,10 @@
@@ -25,7 +25,6 @@