import Cookie from 'js-cookie'
界面:
<a-button
slot="extra"
type="primary"
@click="exportFile"
><a-icon type="download" />导出</a-button>
js方法
exportFile() {
fetch('http://127.0.0.1:8765/course/exportCourse/33', {
method: 'GET',
headers: new Headers({
'Authorization': Cookie.get('Authorization')
}),
})
.then(res => res.blob())
.then(data => {
const blobUrl = window.URL.createObjectURL(data);
const a = document.createElement('a');
a.download = this.fileName+'.xlsx';
a.href = blobUrl;
a.click();
});
},
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://onefire.blog.csdn.net/article/details/124072011
内容来源于网络,如有侵权,请联系作者删除!