mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-24 04:16:38 +08:00
20 lines
452 B
TypeScript
20 lines
452 B
TypeScript
import { h } from 'vue';
|
|
import { Icon } from '@iconify/vue';
|
|
|
|
/**
|
|
* 动态渲染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 });
|
|
}
|