使用场景: 当请求参数时,后端返回的是zip文件时
第一步: 安装 jszip 插件
第二步: 请求参数时,responseType设置为blob
{
responseType:'blob'
}
第三步:
//response就是接口返回的
JSZip.loadAsync(response).then(res=>{
res.file('energy.json').async('string')
.then(content => {
//得到我们需要的JSON文件内容
let response = JSON.parse(content)
})
})