var baseurl = "http://xxx.xxxx.xxx.xxx:xxx"
axios({
url:baseurl+'/export/excel',//后端接口地址
type:'get',
responseType:'blob',
}).then(function(res){
const link = document.createElement("a");
const blob = new Blob([res.data],{
type:'application/vnd.ms-excel',
});
link.style.display = "none";
link.href = URL.createObjectURL(blob);
link.download = "研发投入业务分析报表";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
如果出现这个报错有可能是axios版本问题
failed to read the 'responseText' property from "XMLHttpRequest":The value is only accessible if the object's 'responseType' is '' or 'text' (was 'blob')