feat(projects): refactor icon system, unify icon usage [重构图标系统,统一图标用法]

This commit is contained in:
Soybean
2022-09-23 00:15:00 +08:00
parent fe8cab3d1c
commit 811f820644
47 changed files with 270 additions and 156 deletions

View File

@@ -1,39 +0,0 @@
import { h } from 'vue';
import { NIcon } from 'naive-ui';
import { Icon } from '@iconify/vue';
import SvgIcon from '@/components/custom/SvgIcon.vue';
/**
* 动态渲染iconify
* @param icon - 图标名称
* @param color - 图标颜色
* @param fontSize - 图标大小
*/
export function iconifyRender(icon: string, color?: string, fontSize?: number) {
const style: { color?: string; fontSize?: string } = {};
if (color) {
style.color = color;
}
if (fontSize) {
style.fontSize = `${fontSize}px`;
}
return () => h(NIcon, null, { default: () => h(Icon, { icon, style }) });
}
/**
* 动态渲染自定义图标
* @param icon - 图标名称
* @param color - 图标颜色
* @param fontSize - 图标大小
*/
export function customIconRender(icon: string, color?: string, fontSize?: number) {
const style: { color?: string; fontSize?: string } = {};
if (color) {
style.color = color;
}
if (fontSize) {
style.fontSize = `${fontSize}px`;
}
return () => h(NIcon, null, { default: () => h(SvgIcon, { icon, style }) });
}

View File

@@ -2,6 +2,5 @@ export * from './typeof';
export * from './color';
export * from './number';
export * from './object';
export * from './icon';
export * from './pattern';
export * from './theme';