mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
feat: icon支持自定义样式 (#6379)
Co-authored-by: sarding <hongfuquan@baidu.com>
This commit is contained in:
parent
351571c4c4
commit
30055e438b
@ -5,7 +5,8 @@ import {
|
||||
filter,
|
||||
IconCheckedSchema,
|
||||
autobind,
|
||||
createObject
|
||||
createObject,
|
||||
insertCustomStyle
|
||||
} from 'amis-core';
|
||||
import {BaseSchema, SchemaTpl} from '../Schema';
|
||||
import {BadgeObject, withBadge} from 'amis-ui';
|
||||
@ -76,10 +77,27 @@ export class Icon extends React.Component<IconProps, object> {
|
||||
}
|
||||
|
||||
render() {
|
||||
const {vendor, classnames: cx, className, style, data} = this.props;
|
||||
const {
|
||||
vendor,
|
||||
classnames: cx,
|
||||
className,
|
||||
style,
|
||||
data,
|
||||
css,
|
||||
id
|
||||
} = this.props;
|
||||
let icon = this.props.icon;
|
||||
|
||||
icon = filter(icon, data);
|
||||
insertCustomStyle(
|
||||
css,
|
||||
[
|
||||
{
|
||||
key: 'className',
|
||||
value: className
|
||||
}
|
||||
],
|
||||
id
|
||||
);
|
||||
|
||||
if (typeof icon !== 'string') {
|
||||
if (
|
||||
@ -108,6 +126,8 @@ export class Icon extends React.Component<IconProps, object> {
|
||||
return;
|
||||
}
|
||||
|
||||
icon = filter(icon, data);
|
||||
|
||||
let CustomIcon = getIcon(icon);
|
||||
if (CustomIcon) {
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user