From 8f5981a3130aa25f0358a3fddccd31c450d08c5e Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Wed, 18 May 2022 12:27:49 +0800 Subject: [PATCH] perf: icon --- src/components/ReIcon/src/hooks.ts | 6 ++++-- src/components/ReIcon/src/types.ts | 2 ++ src/views/login/components/phone.vue | 3 +++ src/views/login/components/regist.vue | 3 +++ src/views/login/components/update.vue | 3 +++ src/views/login/index.vue | 3 +++ 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/ReIcon/src/hooks.ts b/src/components/ReIcon/src/hooks.ts index e1eb17fba..1a215a761 100644 --- a/src/components/ReIcon/src/hooks.ts +++ b/src/components/ReIcon/src/hooks.ts @@ -1,6 +1,6 @@ import { iconType } from "./types"; import { h, defineComponent, Component } from "vue"; -import { IconifyIconOffline, FontIcon } from "../index"; +import { IconifyIconOnline, IconifyIconOffline, FontIcon } from "../index"; /** * 支持fontawesome4、5+、iconfont、remixicon、element-plus的icons、自定义svg @@ -37,7 +37,9 @@ export function useRenderIcon(icon: string, attrs?: iconType): Component { return defineComponent({ name: "Icon", render() { - return h(IconifyIconOffline, { + const IconifyIcon = + attrs && attrs["online"] ? IconifyIconOnline : IconifyIconOffline; + return h(IconifyIcon, { icon: icon, ...attrs }); diff --git a/src/components/ReIcon/src/types.ts b/src/components/ReIcon/src/types.ts index 0c06ea49d..7e3ffab35 100644 --- a/src/components/ReIcon/src/types.ts +++ b/src/components/ReIcon/src/types.ts @@ -11,7 +11,9 @@ export interface iconType { horizontalAlign?: boolean; verticalAlign?: boolean; align?: string; + online?: boolean; onLoad?: Function; + includes?: Function; // all icon style?: object; diff --git a/src/views/login/components/phone.vue b/src/views/login/components/phone.vue index 61833bb11..5f5b6456d 100644 --- a/src/views/login/components/phone.vue +++ b/src/views/login/components/phone.vue @@ -59,6 +59,9 @@ function onBack() { clearable v-model="ruleForm.verifyCode" placeholder="短信验证码" + :prefix-icon=" + useRenderIcon('ri:shield-keyhole-line', { online: true }) + " /> { clearable v-model="ruleForm.verifyCode" placeholder="验证码" + :prefix-icon=" + useRenderIcon('ri:shield-keyhole-line', { online: true }) + " >