From 9839746b0090334458f47930cdf132222b48622c Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Tue, 8 Nov 2022 12:13:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=8F=9C=E5=8D=95=E5=9B=BE=E6=A0=87=20?= =?UTF-8?q?`icon`=20=E6=94=AF=E6=8C=81=E4=BD=BF=E7=94=A8=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ReIcon/index.ts | 2 +- src/components/ReIcon/src/hooks.ts | 6 ++++-- src/components/ReIcon/src/iconifyIconOffline.ts | 2 +- src/components/ReIcon/src/types.ts | 1 - 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/ReIcon/index.ts b/src/components/ReIcon/index.ts index 5179723..b9f8807 100644 --- a/src/components/ReIcon/index.ts +++ b/src/components/ReIcon/index.ts @@ -2,7 +2,7 @@ import iconifyIconOffline from "./src/iconifyIconOffline"; import iconifyIconOnline from "./src/iconifyIconOnline"; import fontIcon from "./src/iconfont"; -/** 离线图标组件 */ +/** 本地图标组件 */ const IconifyIconOffline = iconifyIconOffline; /** 在线图标组件 */ const IconifyIconOnline = iconifyIconOnline; diff --git a/src/components/ReIcon/src/hooks.ts b/src/components/ReIcon/src/hooks.ts index 65c4134..4413b51 100644 --- a/src/components/ReIcon/src/hooks.ts +++ b/src/components/ReIcon/src/hooks.ts @@ -3,7 +3,8 @@ import { h, defineComponent, Component } from "vue"; import { IconifyIconOnline, IconifyIconOffline, FontIcon } from "../index"; /** - * 支持fontawesome4、5+、iconfont、remixicon、element-plus的icons、自定义svg + * 支持 `iconfont`、自定义 `svg` 以及 `iconify` 中所有的图标 + * @see 点击查看文档图标篇 {@link https://yiming_chang.gitee.io/pure-admin-doc/pages/icon/} * @param icon 必传 图标 * @param attrs 可选 iconType 属性 * @returns Component @@ -34,11 +35,12 @@ export function useRenderIcon(icon: any, attrs?: iconType): Component { // svg return icon; } else { + // 通过是否存在 : 符号来判断是在线还是本地图标,存在即是在线图标,反之 return defineComponent({ name: "Icon", render() { const IconifyIcon = - attrs && attrs["online"] ? IconifyIconOnline : IconifyIconOffline; + icon && icon.includes(":") ? IconifyIconOnline : IconifyIconOffline; return h(IconifyIcon, { icon: icon, ...attrs diff --git a/src/components/ReIcon/src/iconifyIconOffline.ts b/src/components/ReIcon/src/iconifyIconOffline.ts index b55f25b..63dcf3a 100644 --- a/src/components/ReIcon/src/iconifyIconOffline.ts +++ b/src/components/ReIcon/src/iconifyIconOffline.ts @@ -59,7 +59,7 @@ addIcon("close-all-tags", CloseAllTags); addIcon("fullscreen", Fullscreen); addIcon("exit-fullscreen", ExitFullscreen); -// Iconify Icon在Vue里离线使用(用于内网环境)https://docs.iconify.design/icon-components/vue/offline.html +// Iconify Icon在Vue里本地使用(用于内网环境)https://docs.iconify.design/icon-components/vue/offline.html export default defineComponent({ name: "IconifyIconOffline", components: { IconifyIcon }, diff --git a/src/components/ReIcon/src/types.ts b/src/components/ReIcon/src/types.ts index 7e3ffab..8ae8a54 100644 --- a/src/components/ReIcon/src/types.ts +++ b/src/components/ReIcon/src/types.ts @@ -11,7 +11,6 @@ export interface iconType { horizontalAlign?: boolean; verticalAlign?: boolean; align?: string; - online?: boolean; onLoad?: Function; includes?: Function;