dev_forum
杨树明 5 years ago
parent f9a2d94709
commit 2293487e85

@ -30,13 +30,12 @@ class Fileslistitem extends Component{
downloadfiles=(url,name)=>{ downloadfiles=(url,name)=>{
const aLink = document.createElement('a'); const aLink = document.createElement('a');
document.body.appendChild(aLink);
aLink.style.display='none'; aLink.style.display='none';
aLink.download =name; aLink.download =name;
aLink.href = url; aLink.href = url;
document.body.appendChild(aLink);
aLink.click(); aLink.click();
document.body.removeChild(aLink); // document.body.removeChild(aLink);
} }
showfiles=(value)=>{ showfiles=(value)=>{
let {discussMessage,coursesId}=this.props let {discussMessage,coursesId}=this.props
@ -49,7 +48,7 @@ class Fileslistitem extends Component{
}).then((result)=>{ }).then((result)=>{
if(result.data.attachment_histories.length===0){ if(result.data.attachment_histories.length===0){
this.downloadfiles(result.data.url,filesname) this.downloadfiles(result.data.url,result.data.title)
}else{ }else{
this.setState({ this.setState({
Showoldfiles:true, Showoldfiles:true,

Loading…
Cancel
Save