
想问下大家,调接口后返回的内容如上图所示,这种属于是什么流?是返回的word文档流吗?
我估计你是想下载文件?
如果不是,这个回答请忽略
如果是axios的话,请求时,加个responseType可以试下:
{
url: `xxxxxx`,
method: 'get',
responseType: 'blob'
}
得到Blob再处理一下,
const blob = new Blob([data.data], { type: type })
const a = document.createElement('a')
const href = window.URL.createObjectURL(blob)
a.href = href
a.download = fileName
document.body.appendChild(a)
a.click()
document.body.removeChild(a)
window.URL.revokeObjectURL(href)