赞
踩
- 根据url下载文件
- fetch(/*url链接*/).then((res) => {
- res.blob().then((blob) => {
- const url = window.URL.createObjectURL(blob)
- const a = document.createElement('a')
- a.href = url
- a.download = '测评报告' + '.pdf1';
- a.click()
- window.URL.revokeObjectURL(url)
-
- })
- })
-
- 下载数据流文件
- 请求代码
- axios({
- method: "get",
- url:'https://yingde_api.ydassess.com/health/report/download',
- params: data,
- responseType: 'blob',//必要
- })
-
- 下载代码
-
- let url = window.URL.createObjectURL(new Blob([data]));
- let link = document.createElement("a");
- link.style.display = "none";
- console.log(url)
- return
- link.href = url;
- link.setAttribute("download", "评测报告.pdf");
- document.body.appendChild(link);
- link.click();
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。