WishMeLz

生活其实很有趣

axios 设置了返回类型为文件流,但是不返回文件流

if (res.data.type === "application/json") { 
    let result = await res.data.text();
    result = JSON.parse(reader);
}
if (res.data.type === "application/json") {
    const reader = new FileReader();
    reader.readAsText(res.data, "utf-8");
    reader.onload = () => {
        let result = JSON.parse(reader.result)
    };
}