feat:Remark组件支持自定义图标 (#5694)

* feat:Remark组件支持自定义图标

* 去掉多余内容

Co-authored-by: xujiahao01 <xujiahao01@baidu.com>
This commit is contained in:
徐佳豪 2022-11-04 14:33:33 +08:00 committed by GitHub
parent 2daecf5d11
commit 9b6e75b6ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,7 @@ import {Renderer, RendererProps} from 'amis-core';
import {Api, SchemaNode, Schema, ActionObject} from 'amis-core';
import cx from 'classnames';
import {TooltipWrapper} from 'amis-ui';
import {filter} from 'amis-core';
import {filter, generateIcon} from 'amis-core';
import {ClassNamesFn, themeable} from 'amis-core';
import {hasIcon, Icon} from 'amis-ui';
import {BaseSchema, SchemaClassName, SchemaIcon, SchemaTpl} from '../Schema';
@ -131,7 +131,9 @@ class Remark extends React.Component<RemarkProps> {
<>
{finalLabel ? <span>{finalLabel}</span> : null}
{finalIcon ? (
hasIcon(finalIcon) ? (
typeof finalIcon === 'object' ? (
generateIcon(cx, finalIcon)
) : hasIcon(finalIcon) ? (
<span className={cx('Remark-icon', shapeClass)}>
<Icon icon={finalIcon} />
</span>