@vue-ui-kit/ant
Version:
Vue3 UI Kit based on Ant Design
17 lines (15 loc) • 548 B
text/typescript
import { createVNode, type VNode } from 'vue';
import * as $Icon from '@ant-design/icons-vue';
import { getUIKitConfig } from '@/utils/config';
const Icon = (props: { icon: string }): VNode | null => {
const { icon } = props;
const customRender = getUIKitConfig().icon?.render;
if (customRender) {
const custom = customRender(icon);
if (custom) return custom as VNode;
}
const antIcon: { [key: string]: any } = $Icon;
if (antIcon[icon]) return createVNode(antIcon[icon]);
return null;
};
export default Icon;