perf: 将本地图标全部按需引入,首屏加载减少 61 个图标资源,首屏加载再次变快 (#389)

* perf: 优化图标,将本地图标按需引入,首屏加载减少 `61` 个图标资源,首屏加载再次变快
This commit is contained in:
RealityBoy
2022-11-30 12:39:12 +08:00
committed by GitHub
parent d2b1bd5b44
commit c7ab236e10
63 changed files with 4761 additions and 2259 deletions

View File

@@ -5,6 +5,15 @@ import { getDeptList } from "@/api/system";
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
import { ref, watch, onMounted, getCurrentInstance } from "vue";
import LocationCompany from "@iconify-icons/ep/add-location";
import UnExpand from "@iconify-icons/mdi/arrow-expand-right";
import Expand from "@iconify-icons/mdi/arrow-expand-down";
import More2Fill from "@iconify-icons/ri/more-2-fill";
import Reset from "@iconify-icons/ri/restart-line";
import Dept from "@iconify-icons/ri/git-branch-line";
import OfficeBuilding from "@iconify-icons/ep/office-building";
import Search from "@iconify-icons/ep/search";
interface Tree {
id: number;
name: string;
@@ -85,7 +94,7 @@ onMounted(async () => {
<el-icon class="el-input__icon">
<IconifyIconOffline
v-show="searchValue.length === 0"
icon="search"
:icon="Search"
/>
</el-icon>
</template>
@@ -94,7 +103,7 @@ onMounted(async () => {
<IconifyIconOffline
class="w-[28px] cursor-pointer"
width="18px"
icon="more-vertical"
:icon="More2Fill"
/>
<template #dropdown>
<el-dropdown-menu>
@@ -103,7 +112,7 @@ onMounted(async () => {
class="reset-margin !h-[20px] !text-gray-500 dark:!text-white dark:hover:!text-primary"
link
type="primary"
:icon="useRenderIcon('expand')"
:icon="useRenderIcon(Expand)"
@click="toggleRowExpansionAll(true)"
>
展开全部
@@ -114,7 +123,7 @@ onMounted(async () => {
class="reset-margin !h-[20px] !text-gray-500 dark:!text-white dark:hover:!text-primary"
link
type="primary"
:icon="useRenderIcon('unExpand')"
:icon="useRenderIcon(UnExpand)"
@click="toggleRowExpansionAll(false)"
>
折叠全部
@@ -125,7 +134,7 @@ onMounted(async () => {
class="reset-margin !h-[20px] !text-gray-500 dark:!text-white dark:hover:!text-primary"
link
type="primary"
:icon="useRenderIcon('reset')"
:icon="useRenderIcon(Reset)"
@click="onReset"
>
重置状态
@@ -170,10 +179,10 @@ onMounted(async () => {
<IconifyIconOffline
:icon="
data.type === 1
? 'office-building'
? OfficeBuilding
: data.type === 2
? 'location-company'
: 'dept'
? LocationCompany
: Dept
"
/>
{{ node.label }}