1. window.location.href = '请求路径'get方式
}


2. fetch('请求路径方式拼接上去'get方式).then(res => res.blob().then(blob => {
const a = document.createElement('a')
const url = window.URL.createObjectURL(blob)
const filename = 'aa.xlsx'
a.href = url
a.download = filename
a.click()
window.URL.revokeObjectURL(url)
}))


3.this.exportData.campusId = this.campusId
this.exportData.time = this.changeTimes(this.createEndTime)
axios({
url:'路径'
method: '方式',
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
data: 参数,
responseType: 'blob',
timeout: 120000
}).then(response => {
const blob = new Blob([response.data])
const fileName ='aa.xlsx'
if ('download' in document.createElement('a')) { // 非IE下载
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 { // IE10+下载
navigator.msSaveBlob(blob, fileName)
}
02-01 08:00