From 40c0bd6bb196ec4b9dc19e9be6c4a2928219f7b3 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Wed, 14 Jan 2026 03:42:40 +0800 Subject: [PATCH] fix: improve Button child style order (#56597) * fix: improvement style order * update snap * update undefined * snap update --- components/button/buttonHelpers.tsx | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/components/button/buttonHelpers.tsx b/components/button/buttonHelpers.tsx index 8522661e5c..9aae4e419d 100644 --- a/components/button/buttonHelpers.tsx +++ b/components/button/buttonHelpers.tsx @@ -28,7 +28,7 @@ export function isUnBorderedButtonVariant(type?: ButtonVariantType) { } function splitCNCharsBySpace( - child: React.ReactElement | string | number, + child: React.ReactElement | string | number, needInserted: boolean, style?: React.CSSProperties, className?: string, @@ -43,20 +43,18 @@ function splitCNCharsBySpace( typeof child !== 'string' && typeof child !== 'number' && isString(child.type) && - isTwoCNChar( - ( - child as React.ReactElement<{ - children: string; - }> - ).props.children, - ) + isTwoCNChar((child as React.ReactElement<{ children: string }>).props.children) ) { - return cloneElement(child, (oriProps) => ({ - ...oriProps, - children: oriProps.children.split('').join(SPACE), - className: clsx(oriProps.className, className) || undefined, - style: { ...oriProps.style, ...style }, - })); + return cloneElement(child, (oriProps) => { + const mergedCls = clsx(oriProps.className, className) || undefined; + const mergedStyle: React.CSSProperties = { ...style, ...oriProps.style }; + return { + ...oriProps, + children: oriProps.children.split('').join(SPACE), + className: mergedCls, + style: mergedStyle, + }; + }); } if (isString(child)) {