mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-12-26 06:40:17 +08:00
feat(projects): refactor icon system, unify icon usage [重构图标系统,统一图标用法]
This commit is contained in:
@@ -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 }) });
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user