mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-27 20:49:53 +08:00
improve Modal code style
This commit is contained in:
parent
9ae07d5bc7
commit
ee60b42d6d
@ -66,35 +66,40 @@ export default class Modal extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
let props = this.props;
|
||||
let { okText, cancelText, confirmLoading, footer, visible } = this.props;
|
||||
|
||||
let { okText, cancelText } = props;
|
||||
if (this.context.antLocale && this.context.antLocale.Modal) {
|
||||
okText = okText || this.context.antLocale.Modal.okText;
|
||||
cancelText = cancelText || this.context.antLocale.Modal.cancelText;
|
||||
}
|
||||
|
||||
let defaultFooter = [
|
||||
<Button key="cancel"
|
||||
const defaultFooter = [
|
||||
<Button
|
||||
key="cancel"
|
||||
type="ghost"
|
||||
size="large"
|
||||
onClick={this.handleCancel}
|
||||
>
|
||||
{cancelText || '取消'}
|
||||
</Button>,
|
||||
<Button key="confirm"
|
||||
<Button
|
||||
key="confirm"
|
||||
type="primary"
|
||||
size="large"
|
||||
loading={props.confirmLoading}
|
||||
loading={confirmLoading}
|
||||
onClick={this.handleOk}
|
||||
>
|
||||
{okText || '确定'}
|
||||
</Button>,
|
||||
];
|
||||
let footer = props.footer || defaultFooter;
|
||||
|
||||
return (
|
||||
<Dialog onClose={this.handleCancel} footer={footer} {...props}
|
||||
visible={props.visible} mousePosition={mousePosition}
|
||||
<Dialog
|
||||
onClose={this.handleCancel}
|
||||
footer={footer || defaultFooter}
|
||||
{...this.props}
|
||||
visible={visible}
|
||||
mousePosition={mousePosition}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user