ajax({ 网址:“ / api”, 方法:“ GET”, responseType:“ blob” })。then((res)=> { let blob = new Blob([res.data],{type:'video / mp4'}) 如果(window.navigator && window.navigator.msSaveOrOpenBlob){ window.navigator.msSaveOrOpenBlob(blob,'downloadName'); }其他{ 让路径= window.URL.createObjectURL(blob); 让链接= document.createElement('a'); link.style.display ='none'; link.href =路径; console.log(path); link.setattribute('download','downloadName.mp4'); document.body.appendChild(link); link.click(); window.URL.revokeObjectURL(path); setTimeout(()=> { document.body.removeChild(link); }); } })。catch(()=> { console.log('错误'); })
没有错误,您可以导出mp4,但是单击更改文件提示(此文件无法播放。这可能是由于文件类型不受支持,文件扩展名不正确或文件已损坏)