一、vue中導出按鈕方法中寫法: this.$ajax({ method: 'POST', url: ${this.baseURL}/export
, responseType: 'blob' }).then(res => { const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }) let fileName = 'Excel模板.xls' if ('download' in document.createElement('a')) { const elink = document.createElement('a') elink.download = fileName elink.style.display = 'none' elink.href = URL.createObjectURL(blob) document.body.appendChild(elink) elink.click() URL.revokeObjectURL(elink.href) // 釋放URL 對象 document.body.removeChild(elink) } else { navigator.msSaveBlob(blob, fileName) } }) 二、後臺利用poi導出,代碼省略。。。vue