umi-request 獲取數據流


首發於 語雀文檔

前言

微前端產品開發中使用到了 umi-request 這個,類似於 axios(但貌似又強於 axios),因為碰到文件下載的功能,也即是:獲取數據流,記錄一下。


其實最重要的兩點無非是:

  1. responseType 要設置成 blob

https://github.com/blueju/umi-request-practice/blob/4f11c63e7b47f730ed1bcdde867c6f4575241485/example/get-data-stream.jsx#L14

  1. 如何將響應結果中的文件流導出來

https://github.com/blueju/umi-request-practice/blob/4f11c63e7b47f730ed1bcdde867c6f4575241485/example/get-data-stream.jsx#L16

Github

https://github.com/blueju/umi-request-practice.git

位置

![image.png](https://img-blog.csdnimg.cn/img_convert/8c16b01e31535a476f63da6d29566f37.png#align=left&display=inline&height=433&margin=[object Object]&name=image.png&originHeight=433&originWidth=1280&size=50040&status=done&style=none&width=1280)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM