index.tsx 693 Bytes
import { Button, Popconfirm } from 'antd';
import { TooltipPlacement } from 'antd/lib/tooltip';

const ButtonConfirm = ({
  title,
  description,
  text,
  className,
  onConfirm,
  placement,
}: {
  title: string;
  text: string;
  description?: string;
  className?: string;
  onConfirm?: () => void;
  placement?: TooltipPlacement;
}) => {
  return (
    <Popconfirm
      placement={placement ? placement : 'topLeft'}
      title={title}
      description={description}
      onConfirm={onConfirm}
      okText="确认"
      cancelText="取消"
    >
      <Button type="link" className={className}>
        {text}
      </Button>
    </Popconfirm>
  );
};

export default ButtonConfirm;