that.$axios.post('/ecfinlm/api/open/download?fileName=' + that.reportFilePath, param2, {
responseType: 'blob',
headers: {
'Content-type': 'application/json'
}
}).then(res2 => {
let blob = new Blob([res2.data], {type: "application/vnd.ms-excel"});
let objectUrl = URL.createObjectURL(blob);
window.location.href = objectUrl;
})
类似上面案例:
注意1:
responseType: ‘blob’,必加
注意2:
let blob = new Blob([res2.data], {type: “application/vnd.ms-excel”});
let objectUrl = URL.createObjectURL(blob);
window.location.href = objectUrl;