diff --git a/components/modal/Modal.jsx b/components/modal/Modal.jsx index 7bf8f2a311..7368e840ac 100644 --- a/components/modal/Modal.jsx +++ b/components/modal/Modal.jsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { PropTypes } from 'react'; import Dialog from 'rc-dialog'; import { Dom } from 'rc-util'; import Button from '../button'; @@ -8,7 +8,7 @@ function noop() {} let mousePosition; let mousePositionEventBinded; -let AntModal = React.createClass({ +const AntModal = React.createClass({ getDefaultProps() { return { prefixCls: 'ant-modal', @@ -24,6 +24,21 @@ let AntModal = React.createClass({ }; }, + propTypes: { + prefixCls: PropTypes.string, + onOk: PropTypes.func, + onCancel: PropTypes.func, + okText: PropTypes.node, + cancelText: PropTypes.node, + width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), + confirmLoading: PropTypes.bool, + visible: PropTypes.bool, + align: PropTypes.object, + footer: PropTypes.node, + title: PropTypes.node, + closable: PropTypes.bool, + }, + handleCancel(e) { this.props.onCancel(e); }, diff --git a/components/modal/index.md b/components/modal/index.md index c8b39b68d3..875f4e46d5 100644 --- a/components/modal/index.md +++ b/components/modal/index.md @@ -30,7 +30,8 @@ | footer | 底部内容 | React.Element | 确定取消按钮 | | okText | 确认按钮文字 | String | 确定 | | cancelText | 取消按钮文字 | String | 取消 | -| maskClosable | 点击蒙层是否允许关闭 | Boolean | true | +| maskClosable | 点击蒙层是否允许关闭 | Boolean | true | +| align | 浮层自定义位置 | Object, [dom-align](https://github.com/yiminghe/dom-align) | 距离顶部 100px | ### Modal.xxx()