diff --git a/components/modal/ActionButton.tsx b/components/modal/ActionButton.tsx index e4f8ffa468..e9ea59149d 100644 --- a/components/modal/ActionButton.tsx +++ b/components/modal/ActionButton.tsx @@ -1,9 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import Button from '../button'; +import Button, { ButtonType } from '../button'; export interface ActionButtonProps { - type?: 'primary' | 'dashed'; + type?: ButtonType; actionFn: Function; closeModal: Function; autoFocus?: Boolean; diff --git a/components/modal/Modal.tsx b/components/modal/Modal.tsx index 28d25dfd26..a90955465b 100644 --- a/components/modal/Modal.tsx +++ b/components/modal/Modal.tsx @@ -2,7 +2,7 @@ import React from 'react'; import Dialog from 'rc-dialog'; import PropTypes from 'prop-types'; import addEventListener from 'rc-util/lib/Dom/addEventListener'; -import Button from '../button'; +import Button, { ButtonType } from '../button'; let mousePosition; let mousePositionEventBinded; @@ -27,8 +27,12 @@ export interface ModalProps { footer?: React.ReactNode; /** 确认按钮文字*/ okText?: string; + /** 确认按钮类型*/ + okType?: ButtonType; /** 取消按钮文字*/ cancelText?: string; + /** 取消按钮类型*/ + cancelType?: ButtonType; /** 点击蒙层是否允许关闭*/ maskClosable?: boolean; style?: React.CSSProperties; @@ -54,7 +58,9 @@ export interface ModalFuncProps { width?: string | number; iconClassName?: string; okText?: string; + okType?: ButtonType; cancelText?: string; + cancelType?: ButtonType; iconType?: string; maskClosable?: boolean; } @@ -77,6 +83,7 @@ export default class Modal extends React.Component { maskTransitionName: 'fade', confirmLoading: false, visible: false, + okType: 'primary' }; static propTypes = { @@ -133,7 +140,7 @@ export default class Modal extends React.Component { } render() { - let { okText, cancelText, confirmLoading, footer, visible } = this.props; + let { okText, okType, cancelText, cancelType, confirmLoading, footer, visible } = this.props; if (this.context.antLocale && this.context.antLocale.Modal) { okText = okText || this.context.antLocale.Modal.okText; @@ -143,6 +150,7 @@ export default class Modal extends React.Component { const defaultFooter = [(