fix(utils): 修复iconifyRender

This commit is contained in:
Soybean 2022-07-26 20:55:37 +08:00
parent 35aeedf320
commit c37d0ac788

View File

@ -7,15 +7,15 @@ import SvgIcon from '@/components/custom/SvgIcon.vue';
* iconify
* @param icon -
* @param color -
* @param size -
* @param fontSize -
*/
export function iconifyRender(icon: string, color?: string, size?: number) {
const style: { color?: string; size?: string } = {};
export function iconifyRender(icon: string, color?: string, fontSize?: number) {
const style: { color?: string; fontSize?: string } = {};
if (color) {
style.color = color;
}
if (size) {
style.size = `${size}px`;
if (fontSize) {
style.fontSize = `${fontSize}px`;
}
return () => h(NIcon, null, { default: () => h(Icon, { icon, style }) });
}
@ -24,15 +24,15 @@ export function iconifyRender(icon: string, color?: string, size?: number) {
*
* @param icon -
* @param color -
* @param size -
* @param fontSize -
*/
export function customIconRender(icon: string, color?: string, size?: number) {
const style: { color?: string; size?: string } = {};
export function customIconRender(icon: string, color?: string, fontSize?: number) {
const style: { color?: string; fontSize?: string } = {};
if (color) {
style.color = color;
}
if (size) {
style.size = `${size}px`;
if (fontSize) {
style.fontSize = `${fontSize}px`;
}
return () => h(NIcon, null, { default: () => h(SvgIcon, { icon, style }) });