Add bodyStyle for drawer

This commit is contained in:
ztplz 2019-01-11 22:45:01 +08:00 committed by 偏右
parent 0e1564f499
commit 2ec3c37c42

View File

@ -24,6 +24,7 @@ export interface DrawerProps {
mask?: boolean; mask?: boolean;
maskStyle?: React.CSSProperties; maskStyle?: React.CSSProperties;
style?: React.CSSProperties; style?: React.CSSProperties;
bodyStyle?: React.CSSProperties;
title?: React.ReactNode; title?: React.ReactNode;
visible?: boolean; visible?: boolean;
width?: number | string; width?: number | string;
@ -182,7 +183,7 @@ class Drawer extends React.Component<DrawerProps & ConfigConsumerProps, IDrawerS
// render drawer body dom // render drawer body dom
renderBody = () => { renderBody = () => {
const { placement, prefixCls, visible } = this.props; const { bodyStyle, placement, prefixCls, visible } = this.props;
if (this.destroyClose && !visible) { if (this.destroyClose && !visible) {
return null; return null;
} }
@ -211,7 +212,9 @@ class Drawer extends React.Component<DrawerProps & ConfigConsumerProps, IDrawerS
onTransitionEnd={this.onDestroyTransitionEnd} onTransitionEnd={this.onDestroyTransitionEnd}
> >
{this.renderHeader()} {this.renderHeader()}
<div className={`${prefixCls}-body`}>{this.props.children}</div> <div className={`${prefixCls}-body`} style={bodyStyle}>
{this.props.children}
</div>
</div> </div>
); );
}; };