拆出来方便编辑器实现

This commit is contained in:
liaoxuezhi 2020-09-26 23:30:40 +08:00
parent eb7ddffb73
commit c9b4d13f1f

View File

@ -21,18 +21,23 @@ export interface ButtonToolbarProps
export class ButtonToolbarControl extends React.Component<ButtonToolbarProps> {
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 (
<div className={cx(`${ns}ButtonToolbar`, className)}>
{Array.isArray(buttons)
? buttons.map((button, key) =>
render(`button/${key}`, button, {
key: key
})
)
: null}
{this.renderButtons()}
</div>
);
}