refactor(projects): 去除vicons,统一使用iconify图标

This commit is contained in:
Soybean
2021-11-08 05:13:48 +08:00
parent e61ee32a88
commit cd6db3d491
26 changed files with 290 additions and 145 deletions

View File

@ -1,12 +1,19 @@
import { h } from 'vue';
import type { Component } from 'vue';
import { NIcon } from 'naive-ui';
import { Icon } from '@iconify/vue';
/** 动态渲染vicon */
export function dynamicIconRender(icon: Component) {
return () => {
return h(NIcon, null, {
default: () => h(icon)
});
};
/**
* 动态渲染iconify
* @param icon - 图标名称
* @param color - 图标颜色
* @param size - 图标大小
*/
export function iconifyRender(icon: string, color?: string, size?: number) {
const style: { color?: string; size?: string } = {};
if (color) {
style.color = color;
}
if (size) {
style.size = `${size}px`;
}
return () => h(Icon, { icon, style });
}