mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 04:59:17 +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%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&-iconfont {
|
||||||
|
margin-right: var(--sizes-size-4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-wrapper {
|
&-wrapper {
|
||||||
|
@ -278,6 +278,9 @@ export function Icon({
|
|||||||
|
|
||||||
const Component = getIcon(icon);
|
const Component = getIcon(icon);
|
||||||
const isURLIcon = typeof icon === 'string' && icon?.indexOf('.') !== -1;
|
const isURLIcon = typeof icon === 'string' && icon?.indexOf('.') !== -1;
|
||||||
|
const isIconfont =
|
||||||
|
typeof icon === 'string' &&
|
||||||
|
(~icon?.indexOf('iconfont') || ~icon?.indexOf('fa'));
|
||||||
|
|
||||||
return Component ? (
|
return Component ? (
|
||||||
<>
|
<>
|
||||||
@ -293,6 +296,8 @@ export function Icon({
|
|||||||
</>
|
</>
|
||||||
) : isURLIcon ? (
|
) : isURLIcon ? (
|
||||||
<img className={cx(`${classPrefix}Icon`, className)} src={icon} />
|
<img className={cx(`${classPrefix}Icon`, className)} src={icon} />
|
||||||
|
) : isIconfont ? (
|
||||||
|
<i className={cx(icon, className)} />
|
||||||
) : (
|
) : (
|
||||||
<span className="text-danger">没有 icon {icon}</span>
|
<span className="text-danger">没有 icon {icon}</span>
|
||||||
);
|
);
|
||||||
|
@ -147,7 +147,13 @@ export default class IconSelectControl extends React.PureComponent<
|
|||||||
dangerouslySetInnerHTML={{__html: SvgStr[0].replace(/\\"/g, '"')}}
|
dangerouslySetInnerHTML={{__html: SvgStr[0].replace(/\\"/g, '"')}}
|
||||||
></div>
|
></div>
|
||||||
) : (
|
) : (
|
||||||
<Icon icon={valueTemp} className="icon" />
|
<Icon
|
||||||
|
icon={valueTemp}
|
||||||
|
className={cx(
|
||||||
|
`${ns}IconSelectControl-input-area-iconfont`,
|
||||||
|
'icon'
|
||||||
|
)}
|
||||||
|
/>
|
||||||
)
|
)
|
||||||
) : null}
|
) : null}
|
||||||
<span className={cx(`${ns}IconSelectControl-input-icon-id`)}>
|
<span className={cx(`${ns}IconSelectControl-input-icon-id`)}>
|
||||||
|
Loading…
Reference in New Issue
Block a user