// 创建Blob对象,设置文件类型 let blob = new Blob([res.data], { type: "application/vnd.ms-excel" }) const aLink = document.createElement('a'); document.body.appendChild(aLink); aLink.style.display = 'none'; const objectUrl = window.URL.createObjectURL(blob); aLink.href = objectUrl; aLink.download = obj.fileName; //自定义文件名 aLink.click(); //下载文件 document.body.removeChild(aLink); //针对火狐