Skip to content

Commit

Permalink
fix: fix: [icon] 添加修改样式前缀功能 fix #987
Browse files Browse the repository at this point in the history
  • Loading branch information
haohao_peng authored and albyben committed Dec 10, 2024
1 parent 32105e8 commit 4ca00b2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/icon/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ const InternalIcon: React.ForwardRefRenderFunction<HTMLElement, IIconProps> = (p
const iconRef = (ref as any) || innerRef

const iconPrefix = getPrefixCls!(prefixCls, 'icon', customPrefixcls)
const iconPrefixCls = iconPrefix.replace(/-/g, '')
const lastDashIndex = iconPrefix.lastIndexOf('-')
const iconPrefixCls =
lastDashIndex > -1 ? iconPrefix.slice(0, lastDashIndex) + iconPrefix.slice(lastDashIndex + 1) : iconPrefix
// 兼容之前的类名写法 将kd-icon改为kdicon
const iconClass = classNames(iconPrefixCls, className, {
[`${iconPrefixCls}-${type}`]: type,
Expand Down

0 comments on commit 4ca00b2

Please sign in to comment.