更新时间:2023-12-02 14:17:22
看起来你只需要解析响应的主体,即
Looks like you just need to parse the body of the response i.e
let parsedResponse = data.text();
this.downloadFile(parsedResponse);
我还建议您使用 FileSaver 即使在2016年下载文件也似乎没有一种标准的方式在浏览器中执行此操作。
Also I would recommend you use FileSaver to download files as even in 2016 there does not seem to be a standard way to do this across browsers.
let blob = new Blob([data], { type: 'text/csv' });
saveAs(blob, "data.txt");
如需更深入的指南,请检查这里
For a more in depth guide check here