mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-03 12:38:53 +08:00
fix: 修复图标选择组件无法渲染iconfont (#6974)
Co-authored-by: qinhaoyan <30946345+qinhaoyan@users.noreply.github.com>
This commit is contained in:
parent
7f90d4ee26
commit
ad3bfa8692
@ -66,6 +66,9 @@
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
&-iconfont {
|
||||
margin-right: var(--sizes-size-4);
|
||||
}
|
||||
}
|
||||
|
||||
&-wrapper {
|
||||
|
@ -278,6 +278,9 @@ export function Icon({
|
||||
|
||||
const Component = getIcon(icon);
|
||||
const isURLIcon = typeof icon === 'string' && icon?.indexOf('.') !== -1;
|
||||
const isIconfont =
|
||||
typeof icon === 'string' &&
|
||||
(~icon?.indexOf('iconfont') || ~icon?.indexOf('fa'));
|
||||
|
||||
return Component ? (
|
||||
<>
|
||||
@ -293,6 +296,8 @@ export function Icon({
|
||||
</>
|
||||
) : isURLIcon ? (
|
||||
<img className={cx(`${classPrefix}Icon`, className)} src={icon} />
|
||||
) : isIconfont ? (
|
||||
<i className={cx(icon, className)} />
|
||||
) : (
|
||||
<span className="text-danger">没有 icon {icon}</span>
|
||||
);
|
||||
|
@ -147,7 +147,13 @@ export default class IconSelectControl extends React.PureComponent<
|
||||
dangerouslySetInnerHTML={{__html: SvgStr[0].replace(/\\"/g, '"')}}
|
||||
></div>
|
||||
) : (
|
||||
<Icon icon={valueTemp} className="icon" />
|
||||
<Icon
|
||||
icon={valueTemp}
|
||||
className={cx(
|
||||
`${ns}IconSelectControl-input-area-iconfont`,
|
||||
'icon'
|
||||
)}
|
||||
/>
|
||||
)
|
||||
) : null}
|
||||
<span className={cx(`${ns}IconSelectControl-input-icon-id`)}>
|
||||
|
Loading…
Reference in New Issue
Block a user