From 191ea2fbdb7ead6a3ad9e95c6e99f6a94ae1ae60 Mon Sep 17 00:00:00 2001 From: Sun <1652829889@qq.com> Date: Fri, 25 Sep 2020 15:15:33 +0800 Subject: [PATCH] fix: space can not inherit attrs --- components/space/index.jsx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/components/space/index.jsx b/components/space/index.jsx index 15b5a33c6f..92cd92c925 100644 --- a/components/space/index.jsx +++ b/components/space/index.jsx @@ -49,18 +49,24 @@ const Space = { const mergedAlign = align === undefined && direction === 'horizontal' ? 'center' : align; - const someSpaceClass = { - [prefixCls]: true, - [`${prefixCls}-${direction}`]: true, - // [`${prefixCls}-rtl`]: directionConfig === 'rtl', - [`${prefixCls}-align-${mergedAlign}`]: mergedAlign, - }; + const someSpaceClass = [ + { + [prefixCls]: true, + [`${prefixCls}-${direction}`]: true, + // [`${prefixCls}-rtl`]: directionConfig === 'rtl', + [`${prefixCls}-align-${mergedAlign}`]: mergedAlign, + }, + ]; + + if (content.data.class) { + someSpaceClass.push(content.data.class); + } const itemClassName = `${prefixCls}-item`; const marginDirection = 'marginRight'; // directionConfig === 'rtl' ? 'marginLeft' : 'marginRight'; return ( -