Skip to content

Instantly share code, notes, and snippets.

View mrxf's full-sized avatar
🚀
努力工作中

张树源 mrxf

🚀
努力工作中
View GitHub Profile
@mrxf
mrxf / download.tsx
Last active November 9, 2020 07:42
xhr download file
import { Button, Card, message, Progress, Space } from "antd";
import Axios, { CancelTokenSource } from "axios";
import contentDisposition from "content-disposition";
import React, { useCallback, useRef, useState } from "react";
interface DownloadProps {}
const Download: React.FC<DownloadProps> = () => {
const cancelSource = useRef<CancelTokenSource | null>(null);
const [percentage, setPercentage] = useState<number>(0);