Vue File Download From Spring Boot
File download
如果spring boot的写法是我在另外一个文章, 返回的response其实是一个Blob, 这一点要记住
this.axios.get(url, { responseType: 'blob', timeout: 0 }).then(response => {
// response is Blob <-------
const url = window.URL.createObjectURL(response)
const a = document.createElement('a')
a.style.display = 'none'
a.href = url
a.setAttribute('download','file.xlsx')
document.body.appendChild(a)
a.click()
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
});