Browse Source

perf: 规范注册本地图标时的命名规则,使其更好地配合图标选择器

xiaoxian521 1 year ago
parent
commit
760eac1c4d

+ 40 - 41
src/components/ReIcon/src/offlineIcon.ts

@@ -1,55 +1,54 @@
+// 这里存放本地图标,在 src/layout/index.vue 文件中加载,避免在首启动加载
 import { addIcon } from "@iconify/vue/dist/offline";
 
-/**
- * 这里存放本地图标,在 src/layout/index.vue 文件中加载,避免在首启动加载
- */
-
-// 本地菜单图标,后端在路由的icon中返回对应的图标字符串并且前端在此处使用addIcon添加即可渲染菜单图标
-import UbuntuFill from "@iconify-icons/ri/ubuntu-fill";
+// 本地菜单图标,后端在路由的 icon 中返回对应的图标字符串并且前端在此处使用 addIcon 添加即可渲染菜单图标
+// @iconify-icons/ep
 import Menu from "@iconify-icons/ep/menu";
 import Edit from "@iconify-icons/ep/edit";
-import InformationLine from "@iconify-icons/ri/information-line";
 import SetUp from "@iconify-icons/ep/set-up";
-import TerminalWindowLine from "@iconify-icons/ri/terminal-window-line";
 import Guide from "@iconify-icons/ep/guide";
-import HomeFilled from "@iconify-icons/ep/home-filled";
-import Card from "@iconify-icons/ri/bank-card-line";
-import ListCheck from "@iconify-icons/ri/list-check";
+import Monitor from "@iconify-icons/ep/monitor";
+import Lollipop from "@iconify-icons/ep/lollipop";
 import Histogram from "@iconify-icons/ep/histogram";
+import HomeFilled from "@iconify-icons/ep/home-filled";
+addIcon("ep:menu", Menu);
+addIcon("ep:edit", Edit);
+addIcon("ep:set-up", SetUp);
+addIcon("ep:guide", Guide);
+addIcon("ep:monitor", Monitor);
+addIcon("ep:lollipop", Lollipop);
+addIcon("ep:histogram", Histogram);
+addIcon("ep:home-filled", HomeFilled);
+// @iconify-icons/ri
+import Tag from "@iconify-icons/ri/bookmark-2-line";
 import Ppt from "@iconify-icons/ri/file-ppt-2-line";
-import CheckboxCircleLine from "@iconify-icons/ri/checkbox-circle-line";
-import FlUser from "@iconify-icons/ri/admin-line";
+import Card from "@iconify-icons/ri/bank-card-line";
 import Role from "@iconify-icons/ri/admin-fill";
-import Setting from "@iconify-icons/ri/settings-3-line";
+import Info from "@iconify-icons/ri/file-info-line";
 import Dept from "@iconify-icons/ri/git-branch-line";
-import Search from "@iconify-icons/ri/search-line";
-import Lollipop from "@iconify-icons/ep/lollipop";
-import Monitor from "@iconify-icons/ep/monitor";
-import Tag from "@iconify-icons/ri/bookmark-2-line";
 import Table from "@iconify-icons/ri/table-line";
-import Info from "@iconify-icons/ri/file-info-line";
+import Search from "@iconify-icons/ri/search-line";
+import FlUser from "@iconify-icons/ri/admin-line";
+import Setting from "@iconify-icons/ri/settings-3-line";
 import Artboard from "@iconify-icons/ri/artboard-line";
-addIcon("ubuntuFill", UbuntuFill);
-addIcon("ep:menu", Menu);
-addIcon("edit", Edit);
-addIcon("informationLine", InformationLine);
-addIcon("setUp", SetUp);
-addIcon("terminalWindowLine", TerminalWindowLine);
-addIcon("guide", Guide);
-addIcon("homeFilled", HomeFilled);
-addIcon("card", Card);
-addIcon("listCheck", ListCheck);
-addIcon("histogram", Histogram);
-addIcon("ppt", Ppt);
-addIcon("checkboxCircleLine", CheckboxCircleLine);
-addIcon("ri:admin-line", FlUser);
+import ListCheck from "@iconify-icons/ri/list-check";
+import UbuntuFill from "@iconify-icons/ri/ubuntu-fill";
+import InformationLine from "@iconify-icons/ri/information-line";
+import TerminalWindowLine from "@iconify-icons/ri/terminal-window-line";
+import CheckboxCircleLine from "@iconify-icons/ri/checkbox-circle-line";
+addIcon("ri:bookmark-2-line", Tag);
+addIcon("ri:file-ppt-2-line", Ppt);
+addIcon("ri:bank-card-line", Card);
 addIcon("ri:admin-fill", Role);
-addIcon("ri:settings-3-line", Setting);
+addIcon("ri:file-info-line", Info);
 addIcon("ri:git-branch-line", Dept);
-addIcon("search", Search);
-addIcon("ep:lollipop", Lollipop);
-addIcon("ep:monitor", Monitor);
-addIcon("ri:bookmark-2-line", Tag);
-addIcon("table", Table);
-addIcon("info", Info);
-addIcon("artboard", Artboard);
+addIcon("ri:table-line", Table);
+addIcon("ri:search-line", Search);
+addIcon("ri:admin-line", FlUser);
+addIcon("ri:settings-3-line", Setting);
+addIcon("ri:artboard-line", Artboard);
+addIcon("ri:list-check", ListCheck);
+addIcon("ri:ubuntu-fill", UbuntuFill);
+addIcon("ri:information-line", InformationLine);
+addIcon("ri:terminal-window-line", TerminalWindowLine);
+addIcon("ri:checkbox-circle-line", CheckboxCircleLine);

+ 1 - 1
src/layout/components/search/index.vue

@@ -14,7 +14,7 @@ function handleSearch() {
       class="search-container w-[40px] h-[48px] flex-c cursor-pointer navbar-bg-hover"
       @click="handleSearch"
     >
-      <IconifyIconOffline icon="search" />
+      <IconifyIconOffline icon="ri:search-line" />
     </div>
     <SearchModal v-model:value="show" />
   </div>

+ 1 - 1
src/layout/types.ts

@@ -8,7 +8,7 @@ export const routerArrays: Array<RouteConfigs> =
           path: "/welcome",
           meta: {
             title: "menus.hshome",
-            icon: "homeFilled"
+            icon: "ep:home-filled"
           }
         }
       ]

+ 1 - 1
src/router/modules/able.ts

@@ -5,7 +5,7 @@ export default {
   path: "/able",
   redirect: "/able/watermark",
   meta: {
-    icon: "ubuntuFill",
+    icon: "ri:ubuntu-fill",
     title: $t("menus.hsAble"),
     rank: able
   },

+ 1 - 1
src/router/modules/about.ts

@@ -5,7 +5,7 @@ export default {
   path: "/about",
   redirect: "/about/index",
   meta: {
-    icon: "info",
+    icon: "ri:file-info-line",
     title: $t("menus.hsAbout"),
     rank: about
   },

+ 1 - 1
src/router/modules/board.ts

@@ -6,7 +6,7 @@ export default {
   path: "/board",
   redirect: "/board/index",
   meta: {
-    icon: "artboard",
+    icon: "ri:artboard-line",
     title: $t("menus.hsboard"),
     rank: board
   },

+ 1 - 1
src/router/modules/editor.ts

@@ -5,7 +5,7 @@ export default {
   path: "/editor",
   redirect: "/editor/index",
   meta: {
-    icon: "edit",
+    icon: "ep:edit",
     title: $t("menus.hseditor"),
     rank: editor
   },

+ 1 - 1
src/router/modules/error.ts

@@ -5,7 +5,7 @@ export default {
   path: "/error",
   redirect: "/error/403",
   meta: {
-    icon: "informationLine",
+    icon: "ri:information-line",
     // showLink: false,
     title: $t("menus.hsabnormal"),
     rank: error

+ 1 - 1
src/router/modules/flowchart.ts

@@ -5,7 +5,7 @@ export default {
   path: "/flow-chart",
   redirect: "/flow-chart/index",
   meta: {
-    icon: "setUp",
+    icon: "ep:set-up",
     title: $t("menus.hsflowChart"),
     rank: flowchart
   },

+ 1 - 1
src/router/modules/formdesign.ts

@@ -6,7 +6,7 @@ export default {
   path: "/form-design",
   redirect: "/form-design/index",
   meta: {
-    icon: "terminalWindowLine",
+    icon: "ri:terminal-window-line",
     title: $t("menus.hsFormDesign"),
     rank: formdesign
   },

+ 1 - 1
src/router/modules/guide.ts

@@ -5,7 +5,7 @@ export default {
   path: "/guide",
   redirect: "/guide/index",
   meta: {
-    icon: "guide",
+    icon: "ep:guide",
     title: $t("menus.hsguide"),
     rank: guide
   },

+ 1 - 1
src/router/modules/home.ts

@@ -9,7 +9,7 @@ export default {
   component: Layout,
   redirect: "/welcome",
   meta: {
-    icon: "homeFilled",
+    icon: "ep:home-filled",
     title: $t("menus.hshome"),
     rank: home
   },

+ 2 - 2
src/router/modules/list.ts

@@ -5,7 +5,7 @@ export default {
   path: "/list",
   redirect: "/list/card",
   meta: {
-    icon: "listCheck",
+    icon: "ri:list-check",
     title: $t("menus.hsList"),
     rank: list
   },
@@ -15,7 +15,7 @@ export default {
       name: "ListCard",
       component: () => import("@/views/list/card/index.vue"),
       meta: {
-        icon: "card",
+        icon: "ri:bank-card-line",
         title: $t("menus.hsListCard"),
         showParent: true
       }

+ 1 - 1
src/router/modules/nested.ts

@@ -6,7 +6,7 @@ export default {
   redirect: "/nested/menu1/menu1-1",
   meta: {
     title: $t("menus.hsmenus"),
-    icon: "histogram",
+    icon: "ep:histogram",
     rank: nested
   },
   children: [

+ 1 - 1
src/router/modules/ppt.ts

@@ -5,7 +5,7 @@ export default {
   path: "/ppt",
   redirect: "/ppt/index",
   meta: {
-    icon: "ppt",
+    icon: "ri:file-ppt-2-line",
     title: "PPT",
     rank: ppt
   },

+ 1 - 1
src/router/modules/result.ts

@@ -5,7 +5,7 @@ export default {
   path: "/result",
   redirect: "/result/success",
   meta: {
-    icon: "checkboxCircleLine",
+    icon: "ri:checkbox-circle-line",
     title: $t("menus.hsResult"),
     rank: result
   },

+ 1 - 1
src/router/modules/table.ts

@@ -5,7 +5,7 @@ export default {
   path: "/pure-table",
   redirect: "/pure-table/index",
   meta: {
-    icon: "table",
+    icon: "ri:table-line",
     title: "pure-admin-table",
     rank: table
   },

+ 3 - 3
src/views/components/segmented.vue

@@ -86,7 +86,7 @@ const optionsIcon: Array<OptionsType> = [
   },
   {
     label: "周三",
-    icon: "terminalWindowLine"
+    icon: "ri:terminal-window-line"
   },
   {
     label: "周四"
@@ -103,7 +103,7 @@ const optionsOnlyIcon: Array<OptionsType> = [
     icon: HomeFilled
   },
   {
-    icon: "terminalWindowLine"
+    icon: "ri:terminal-window-line"
   },
   {
     icon: "streamline-emojis:cow-face"
@@ -131,7 +131,7 @@ const optionsLabel: Array<OptionsType> = [
   {
     label: () => (
       <div>
-        {h(useRenderIcon("terminalWindowLine"), {
+        {h(useRenderIcon("ri:terminal-window-line"), {
           class: "m-auto mt-1 w-[18px] h-[18px]"
         })}
         <p>周二</p>

+ 1 - 1
src/views/list/card/index.vue

@@ -110,7 +110,7 @@ const handleManageProduct = product => {
           <el-icon class="el-input__icon">
             <IconifyIconOffline
               v-show="searchValue.length === 0"
-              icon="search"
+              icon="ri:search-line"
             />
           </el-icon>
         </template>

+ 1 - 1
src/views/system/dept/index.vue

@@ -58,7 +58,7 @@ const {
       <el-form-item>
         <el-button
           type="primary"
-          :icon="useRenderIcon('search')"
+          :icon="useRenderIcon('ri:search-line')"
           :loading="loading"
           @click="onSearch"
         >

+ 1 - 1
src/views/system/menu/index.vue

@@ -48,7 +48,7 @@ const {
       <el-form-item>
         <el-button
           type="primary"
-          :icon="useRenderIcon('search')"
+          :icon="useRenderIcon('ri:search-line')"
           :loading="loading"
           @click="onSearch"
         >

+ 1 - 1
src/views/system/role/index.vue

@@ -74,7 +74,7 @@ const {
       <el-form-item>
         <el-button
           type="primary"
-          :icon="useRenderIcon('search')"
+          :icon="useRenderIcon('ri:search-line')"
           :loading="loading"
           @click="onSearch"
         >

+ 1 - 1
src/views/system/user/index.vue

@@ -95,7 +95,7 @@ const {
         <el-form-item>
           <el-button
             type="primary"
-            :icon="useRenderIcon('search')"
+            :icon="useRenderIcon('ri:search-line')"
             :loading="loading"
             @click="onSearch"
           >

+ 1 - 1
src/views/system/user/tree.vue

@@ -110,7 +110,7 @@ defineExpose({ onTreeReset });
           <el-icon class="el-input__icon">
             <IconifyIconOffline
               v-show="searchValue.length === 0"
-              icon="search"
+              icon="ri:search-line"
             />
           </el-icon>
         </template>

+ 1 - 1
src/views/welcome/components/table/index.vue

@@ -36,7 +36,7 @@ const { loading, columns, dataList, pagination, Empty, onCurrentChange } =
         circle
         size="small"
         :title="`查看序号为${row.id}的详情`"
-        :icon="useRenderIcon('search')"
+        :icon="useRenderIcon('ri:search-line')"
       />
     </template>
   </pure-table>