// type1
await getFile(fileUrl).then((res) => {
console.log('download',res);
let bFile = window.URL.createObjectURL(
new Blob([res])
)
this.download(bFile, this.viewData.file_name)
}); // type2
window.open(fileUrl)
// type3
setTimeout(() => {
let a = document.createElement("a");
let url = fileUrl; //下载url
let filename = "download";
a.href = url;
a.download = filename;
a.click();
}, 500);
// type4
setTimeout(() => {
let myFrame = document.createElement("iframe");
myFrame.src = fileUrl;
myFrame.style.display = "none";
document.body.appendChild(myFrame);
window.open(fileUrl);
}, 500);
// type5
let url = "fileurl" // 文件绝对路径
var a = document.createElement("a");
a.setAttribute("href", url);
a.setAttribute("target", "_blank");
let clickEvent = document.createEvent("MouseEvents");
clickEvent.initEvent("click", true, true);
a.dispatchEvent(clickEvent);

最新文章

  1. Matlab中^2和.^2的区别
  2. Server ran out of threads to serve requests. Consider raising the ThreadsPerChild setting
  3. VIM的配置文件(vimrc)在哪里?【Win7】
  4. 图文教程:手把手教你用U盘安装Ubuntu
  5. C++ 头文件系列 (algorithm)
  6. GLUT Trackball Demo
  7. Dynamics CRM2016 Update or Create parentcustomerid in Contact using web api
  8. WebUtils【MD5加密(基于MessageDigest)】
  9. IP网际协议
  10. 学号20175313 《Arrays和String单元测试》第八周
  11. luogu P1353 【[USACO08JAN]跑步Running】
  12. 【python】python为何多线程无法切换
  13. JSAP106
  14. AMD Cpu 性能分析
  15. Xcode下的中文乱码问题
  16. ThreadLocal 与 Synchronized区别
  17. SQL记录-PLSQL包
  18. ASP代码审计学习笔记 -4.命令执行漏洞
  19. 代码使用了php的包管理器composer,include到你的php脚本
  20. solr分词一:mmseg4j

热门文章

  1. [bzoj5418]屠龙勇士
  2. [bzoj1385]Division expression
  3. [bzoj3304]带限制的最长公共子序列
  4. 五、Zookeeper的Shell操作
  5. 在spring启动后执行代码
  6. 【POJ1845】Sumdiv【算数基本定理 + 逆元】
  7. CF1555F Good Graph
  8. PostgreSQL 数据库备份与还原
  9. C++ and OO Num. Comp. Sci. Eng. - Part 1.
  10. 蛋白质组DIA深度学习之谱图预测