From 2f52011491469c31a1e77063f1f5030acc0a9226 Mon Sep 17 00:00:00 2001 From: Vicky <10212746+haifeng-jiang@user.noreply.gitee.com> Date: Fri, 30 Oct 2026 17:14:51 +0800 Subject: [PATCH] =?UTF-8?q?perf(build):=20=E5=9B=BE=E6=A0=87=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E7=A6=BB=E7=BA=BF=E5=AD=90=E9=9B=86=E5=B9=B6=E7=B2=BE?= =?UTF-8?q?=E7=AE=80=E5=9B=BE=E8=A1=A8=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/icons/material-symbols-subset.json | 1 + src/components/Icon/src/Icon.vue | 12 ++----- src/main.ts | 3 ++ src/plugins/echarts/index.ts | 20 ++--------- src/plugins/icons/index.ts | 6 ++++ src/views/dashboard/DashboardMetricWall.vue | 26 ++++++++++----- uno.config.ts | 33 ++----------------- 7 files changed, 34 insertions(+), 67 deletions(-) create mode 100644 src/assets/icons/material-symbols-subset.json create mode 100644 src/plugins/icons/index.ts diff --git a/src/assets/icons/material-symbols-subset.json b/src/assets/icons/material-symbols-subset.json new file mode 100644 index 0000000..8fe97e7 --- /dev/null +++ b/src/assets/icons/material-symbols-subset.json @@ -0,0 +1 @@ +{"prefix":"material-symbols","info":{"name":"Material Symbols","total":15728,"author":{"name":"Google","url":"https://github.com/google/material-design-icons"},"license":{"title":"Apache 2.0","spdx":"Apache-2.0","url":"https://github.com/google/material-design-icons/blob/master/LICENSE"},"samples":["downloading","privacy-tip","filter-drama-outline","assignment-ind","monitoring","desktop-access-disabled-outline-sharp"],"height":24,"category":"Material","tags":["Has Padding"],"palette":false},"lastModified":1791524209,"width":24,"height":24,"icons":{"menu-rounded":{"body":""},"menu-open-rounded":{"body":""},"dashboard-rounded":{"body":""},"video-library-rounded":{"body":""},"settings-rounded":{"body":""},"group-rounded":{"body":""},"movie-edit-rounded":{"body":""},"policy-rounded":{"body":""},"payments-rounded":{"body":""},"monitoring-rounded":{"body":""},"video-camera-front-rounded":{"body":""},"campaign-rounded":{"body":""},"fullscreen-rounded":{"body":""},"fullscreen-exit-rounded":{"body":""},"format-size-rounded":{"body":""},"translate-rounded":{"body":""},"dark-mode-rounded":{"body":""},"light-mode-rounded":{"body":""},"refresh-rounded":{"body":""},"restart-alt-rounded":{"body":""},"close-rounded":{"body":""},"chevron-left-rounded":{"body":""},"chevron-right-rounded":{"body":""},"keyboard-arrow-down-rounded":{"body":""},"keyboard-arrow-up-rounded":{"body":""},"search-rounded":{"body":""},"combine-columns-rounded":{"body":""},"help-rounded":{"body":""},"add-rounded":{"body":""},"edit-rounded":{"body":""},"delete-rounded":{"body":""},"upload-rounded":{"body":""},"download-rounded":{"body":""},"content-copy-rounded":{"body":""},"open-in-new-rounded":{"body":""},"visibility-rounded":{"body":""},"arrow-upward-rounded":{"body":""},"arrow-downward-rounded":{"body":""},"arrow-back-rounded":{"body":""},"arrow-forward-rounded":{"body":""},"check-rounded":{"body":""},"check-circle-rounded":{"body":""},"cancel-rounded":{"body":""},"lock-person-rounded":{"body":""},"logout-rounded":{"body":""},"person-rounded":{"body":""},"schedule-rounded":{"body":""},"smart-display-rounded":{"body":""},"drag-handle-rounded":{"body":""},"label-rounded":{"body":""},"horizontal-rule-rounded":{"body":""},"split-scene-left-rounded":{"body":""},"split-scene-right-rounded":{"body":""},"warning-rounded":{"body":""},"error-rounded":{"body":""},"info-rounded":{"body":""}}} diff --git a/src/components/Icon/src/Icon.vue b/src/components/Icon/src/Icon.vue index ecc7af5..df1fc52 100644 --- a/src/components/Icon/src/Icon.vue +++ b/src/components/Icon/src/Icon.vue @@ -5,7 +5,7 @@ import { computed, unref } from 'vue' import { ElIcon } from 'element-plus' import { propTypes } from '@/utils/propTypes' import { useDesign } from '@/hooks/web/useDesign' -import { Icon } from '@iconify/vue' +import { Icon } from '@iconify/vue/offline' import { normalizeAppIcon } from '@/constants/icons' const { getPrefixCls } = useDesign() @@ -29,11 +29,6 @@ const symbolId = computed(() => { return unref(isLocal) ? `#icon-${props.icon.split('svg-icon:')[1]}` : unref(normalizedIcon) }) -// 是否使用在线图标 -const isUseOnline = computed(() => { - return import.meta.env.VITE_USE_ONLINE_ICON === 'true' -}) - const getIconifyStyle = computed(() => { const { color, size } = props return { @@ -49,10 +44,7 @@ const getIconifyStyle = computed(() => { - + diff --git a/src/main.ts b/src/main.ts index 61ac03d..31c1d01 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,6 +5,9 @@ import 'vue/jsx' // 引入unocss import '@/plugins/unocss' +// 注册后台使用的本地图标子集 +import '@/plugins/icons' + // 导入全局的svg图标 import '@/plugins/svgIcon' diff --git a/src/plugins/echarts/index.ts b/src/plugins/echarts/index.ts index dcba0a3..f1c8050 100644 --- a/src/plugins/echarts/index.ts +++ b/src/plugins/echarts/index.ts @@ -2,22 +2,12 @@ import * as echarts from 'echarts/core' -import { - BarChart, - LineChart, - PieChart, - MapChart, - PictorialBarChart, - RadarChart -} from 'echarts/charts' +import { BarChart, LineChart, PieChart } from 'echarts/charts' import { TitleComponent, TooltipComponent, GridComponent, - PolarComponent, - AriaComponent, - ParallelComponent, LegendComponent } from 'echarts/components' @@ -28,16 +18,10 @@ echarts.use([ TitleComponent, TooltipComponent, GridComponent, - PolarComponent, - AriaComponent, - ParallelComponent, BarChart, LineChart, PieChart, - MapChart, - CanvasRenderer, - PictorialBarChart, - RadarChart + CanvasRenderer ]) export default echarts diff --git a/src/plugins/icons/index.ts b/src/plugins/icons/index.ts new file mode 100644 index 0000000..d0a0257 --- /dev/null +++ b/src/plugins/icons/index.ts @@ -0,0 +1,6 @@ +// Author: fruit.com.cn + +import { addCollection } from '@iconify/vue/offline' +import materialSymbols from '@/assets/icons/material-symbols-subset.json' + +addCollection(materialSymbols) diff --git a/src/views/dashboard/DashboardMetricWall.vue b/src/views/dashboard/DashboardMetricWall.vue index f8d0944..d4552c9 100644 --- a/src/views/dashboard/DashboardMetricWall.vue +++ b/src/views/dashboard/DashboardMetricWall.vue @@ -3,7 +3,7 @@