const exportword = async () =>{

window.ajax1({

url: '/api/DownloadYearWordReport/Download?year=' + year.value + '&half=' + half.value,

method: 'get',

responseType: 'blob',

})

.then(res => {

if (!res.data) {

return

}

let url = window.URL.createObjectURL(new Blob([res.data]))

let link = document.createElement('a')

link.style.display = 'none'

link.href = url

link.setAttribute('download', 'exprotword.docx')

document.body.appendChild(link)

link.click()

// 释放URL对象所占资源

window.URL.revokeObjectURL(url)

// 用完即删

document.body.removeChild(link)

})

.catch(res => { console.log(res)})

};

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐