Skip to content

Commit

Permalink
fix(utils): 修复iconifyRender
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Jul 26, 2022
1 parent 35aeedf commit c37d0ac
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/utils/common/icon.ts
Expand Up @@ -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 }) });
}
Expand All @@ -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 }) });
Expand Down

0 comments on commit c37d0ac

Please sign in to comment.