From 5f0b1ef006fe2632910b461a83154d0563f3cbea Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 12 Apr 2016 11:56:14 +0800 Subject: [PATCH] Fix button text span wrap --- components/button/button.jsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/button/button.jsx b/components/button/button.jsx index 7a287e3fb6..725a6fb780 100644 --- a/components/button/button.jsx +++ b/components/button/button.jsx @@ -11,15 +11,16 @@ function isString(str) { // Insert one space between two chinese characters automatically. function insertSpace(child) { - if (isString(child) && isTwoCNChar(child)) { - return child.split('').join(' '); - } - if (isString(child.type) && isTwoCNChar(child.props.children)) { return React.cloneElement(child, {}, child.props.children.split('').join(' ')); } - + if (isString(child)) { + if (isTwoCNChar(child)) { + child = child.split('').join(' '); + } + return {child}; + } return child; }