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 { iconType } from "./types";
import { h, defineComponent, Component } from "vue"; import { h, defineComponent, Component } from "vue";
import { IconifyIconOffline, FontIcon } from "../index"; import { IconifyIconOnline, IconifyIconOffline, FontIcon } from "../index";
/** /**
* fontawesome45+iconfontremixiconelement-plus的iconssvg * fontawesome45+iconfontremixiconelement-plus的iconssvg
@ -37,7 +37,9 @@ export function useRenderIcon(icon: string, attrs?: iconType): Component {
return defineComponent({ return defineComponent({
name: "Icon", name: "Icon",
render() { render() {
return h(IconifyIconOffline, { const IconifyIcon =
attrs && attrs["online"] ? IconifyIconOnline : IconifyIconOffline;
return h(IconifyIcon, {
icon: icon, icon: icon,
...attrs ...attrs
}); });

View File

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

View File

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

View File

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

View File

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

View File

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