downloadMoban(url) { const xhr = new XMLHttpRequest() xhr.open('get', url) xhr.setRequestHeader('Authorization', this.Authorization) xhr.responseType = 'blob' xhr.send() const name = this.crud.batch.isBatch ? '批量修改模板.xlsx' : '新增模板.xlsx' xhr.onload = function() { if (this.status === 200 || this.status === 304) { if ('msSaveOrOpenBlob' in navigator) { navigator.msSaveOrOpenBlob(this.response) return } const url = URL.createObjectURL(this.response) const a = document.createElement('a') a.style.display = 'none' a.href = url a.download = name document.body.appendChild(a) a.click() document.body.removeChild(a) URL.revokeObjectURL(url) } } }