From c9b4d13f1f2533e24a7a8ace44b83fdc37ef494f Mon Sep 17 00:00:00 2001 From: liaoxuezhi <2betop.cn@gmail.com> Date: Sat, 26 Sep 2020 23:30:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=86=E5=87=BA=E6=9D=A5=E6=96=B9=E4=BE=BF?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderers/Form/ButtonToolbar.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/renderers/Form/ButtonToolbar.tsx b/src/renderers/Form/ButtonToolbar.tsx index 54108ecb0..4032bf46d 100644 --- a/src/renderers/Form/ButtonToolbar.tsx +++ b/src/renderers/Form/ButtonToolbar.tsx @@ -21,18 +21,23 @@ export interface ButtonToolbarProps export class ButtonToolbarControl extends React.Component { static defaultProps = {}; + renderButtons() { + const {render, classPrefix: ns, buttons} = this.props; + return Array.isArray(buttons) + ? buttons.map((button, key) => + render(`button/${key}`, button, { + key: key + }) + ) + : null; + } + render() { const {render, className, classPrefix: ns, buttons} = this.props; return (
- {Array.isArray(buttons) - ? buttons.map((button, key) => - render(`button/${key}`, button, { - key: key - }) - ) - : null} + {this.renderButtons()}
); }