import { Modal, Progress } from 'antd'; import { useRef } from 'react'; export default function useProgress(title: string) { const modalRef = useRef>(); const ProgressElement = ({ percent }: { percent: number }) => ( ); const showProgress = (percent: number) => { if (modalRef.current) { modalRef.current.update({ title: `${title}${percent >= 100 ? '成功' : '中...'}`, content: , }); } else { modalRef.current = Modal.info({ width: 600, maskClosable: false, title: `${title}${percent >= 100 ? '成功' : '中...'}`, centered: true, content: , }); } }; return showProgress; }