index.tsx 630 Bytes
import { Modal, ModalFuncProps } from 'antd';
import { ExclamationCircleFilled } from '@ant-design/icons';

const { confirm } = Modal;

const showPropsConfirm = ({
  title,
  icon,
  content,
  okText,
  okType,
  okButtonProps,
  cancelText,
  onOk,
  onCancel,
}: ModalFuncProps) => {
  confirm({
    title: title,
    icon: icon || <ExclamationCircleFilled />,
    content: content,
    okText: okText,
    okType: okType,
    okButtonProps: okButtonProps, //是个对象,其中disabled属性就是在这里设置
    cancelText: cancelText,
    onOk: onOk,
    onCancel: onCancel,
  });
};

export default showPropsConfirm;