this.$get(url, {}, { responseType: 'blob' }).then(res => {
//创建隐藏的可下载链接
const blob = new Blob([res]);
const link = document.createElement('a');
const evt = document.createEvent('HTMLEvents');
evt.initEvent('click', false, false);
link.href = URL.createObjectURL(blob); //触发点击
link.download = req.name + suffixName;
link.style.display = 'none'; //字符内容转变成blob地址
document.body.appendChild(link);
link.click();//然后移除
//释放内存
window.URL.revokeObjectURL(link.href);
document.body.removeChild(link );
});
前端导出pdf文件
最新推荐文章于 2024-12-25 14:14:38 发布
1097

被折叠的 条评论
为什么被折叠?



