perf: icon

This commit is contained in:
xiaoxian521 2022-05-18 12:27:49 +08:00
parent 378feceb5f
commit 8f5981a313
6 changed files with 18 additions and 2 deletions

View File

@ -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";
/**
* fontawesome45+iconfontremixiconelement-plus的iconssvg
@ -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
});

View File

@ -11,7 +11,9 @@ export interface iconType {
horizontalAlign?: boolean;
verticalAlign?: boolean;
align?: string;
online?: boolean;
onLoad?: Function;
includes?: Function;
// all icon
style?: object;

View File

@ -59,6 +59,9 @@ function onBack() {
clearable
v-model="ruleForm.verifyCode"
placeholder="短信验证码"
:prefix-icon="
useRenderIcon('ri:shield-keyhole-line', { online: true })
"
/>
<el-button
:disabled="isDisabled"

View File

@ -101,6 +101,9 @@ function onBack() {
clearable
v-model="ruleForm.verifyCode"
placeholder="短信验证码"
:prefix-icon="
useRenderIcon('ri:shield-keyhole-line', { online: true })
"
/>
<el-button
:disabled="isDisabled"

View File

@ -80,6 +80,9 @@ function onBack() {
clearable
v-model="ruleForm.verifyCode"
placeholder="短信验证码"
:prefix-icon="
useRenderIcon('ri:shield-keyhole-line', { online: true })
"
/>
<el-button
:disabled="isDisabled"

View File

@ -114,6 +114,9 @@ watch(imgCode, value => {
clearable
v-model="ruleForm.verifyCode"
placeholder="验证码"
:prefix-icon="
useRenderIcon('ri:shield-keyhole-line', { online: true })
"
>
<template v-slot:append>
<ReImageVerify v-model:code="imgCode" />