Antd V4 使用iconType创建Icon,可动态设置iconType

image.png

后台数据库存的icon type是antd v4的icon

image.png

前端页面应该如何使用显示icon呢

解决办法如下

import React from "react";
import  * as Icon from '@ant-design/icons';

var iconType = 'MessageOutlined';

export default function App() {
  return (
    
{ React.createElement( Icon[iconType], { style:{ fontSize: '16px', color: '#08c' } } ) }
); }

你可能感兴趣的:(Antd V4 使用iconType创建Icon,可动态设置iconType)