import React from 'react'; /** * todo 目前是单独处理 图标的 * @param Component 基础组件 * @param content 内容 * @param defaultProps 默认参数 * @returns */ const renderNode = (Component: any, content: any, defaultProps: any = {}) => { if (content == null || content === false) { return null; } if (React.isValidElement(content)) { return content; } if (typeof content === 'function') { return content(); } // Just in case if (content === true) { return ; } if (typeof content === 'string') { if (content.length === 0) { return null; } return {content}; } if (typeof content === 'number') { return {content}; } return ; }; export default renderNode;