diff --git a/components/modal/demo/custom.md b/components/modal/demo/custom.md index f0f6b0fdeb..6d2444b498 100644 --- a/components/modal/demo/custom.md +++ b/components/modal/demo/custom.md @@ -2,7 +2,7 @@ - order: 1 - +点击确定后异步关闭对话框。 --- diff --git a/components/modal/demo/footer.md b/components/modal/demo/footer.md new file mode 100644 index 0000000000..c52d37080e --- /dev/null +++ b/components/modal/demo/footer.md @@ -0,0 +1,57 @@ +# 自定义页脚 + +- order: 2 + +更复杂的例子,点击提交后进入 loading 状态,完成后关闭。 + +--- + +````jsx +var Modal = antd.Modal; + +var Test = React.createClass({ + getInitialState: function() { + return { + loading: false + }; + }, + showModal() { + this.refs.modal.show(); + }, + handleOk() { + this.setState({ + loading: true + }); + setTimeout(()=> { + this.refs.modal.hide(); + this.setState({ + loading: false + }); + }, 3000); + }, + handleCancel() { + this.refs.modal.hide(); + }, + render() { + return
+ + 返 回, + + ]}> +

对话框的内容

+
+
; + } +}); + +React.render( , document.getElementById('components-modal-demo-footer')); +```` diff --git a/components/modal/index.jsx b/components/modal/index.jsx index b040b35062..4c80a33b3b 100644 --- a/components/modal/index.jsx +++ b/components/modal/index.jsx @@ -44,7 +44,8 @@ var Modal = React.createClass({ render() { var props = this.props; - var footer = [ + console.log(props); + var footer = props.footer || [ , ]; diff --git a/components/modal/index.md b/components/modal/index.md index e61383f344..25af793e01 100644 --- a/components/modal/index.md +++ b/components/modal/index.md @@ -19,7 +19,6 @@ |------------|----------------|------------------|--------------| | title | 标题 | React.Element | 无 | | onOk | 点击确定回调 | function | 无 | -| onBeforeClose | 点击遮罩层或右上角叉或取消按钮关闭前回调 | function | 无 | +| onCancel | 点击遮罩层或右上角叉或取消按钮的回调 | function | 无 | | width | 宽度 | String or Number | 500 | -| visible | 是否显示 | Boolean | false | | footer | 底部内容 | React.Element | 确定取消按钮 |