From 5690f0b21f83e1677f85bdcb87471bba5116bcf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Sat, 6 Jul 2019 17:20:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/Resource/Fileslistitem.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/Resource/Fileslistitem.js b/public/react/src/modules/courses/Resource/Fileslistitem.js index 57c69f837..4e6a9384c 100644 --- a/public/react/src/modules/courses/Resource/Fileslistitem.js +++ b/public/react/src/modules/courses/Resource/Fileslistitem.js @@ -56,7 +56,15 @@ class Fileslistitem extends Component{ }, }).then((result)=>{ if(result.data.attachment_histories.length===0){ - this.downloadfiles(result.data.url) + let link = document.createElement('a'); + document.body.appendChild(link); + link.href = result.data.url; + link.download = result.data.title; + //兼容火狐浏览器 + let evt = document.createEvent("MouseEvents"); + evt.initEvent("click", false, false); + link.dispatchEvent(evt); + document.body.removeChild(link); }else{ this.setState({ Showoldfiles:true,