钉钉、微博极速扩容黑科技,点击观看阿里云弹性计算年度发布会!>>>
亲测有效
dowloadTest(){this.$axios.request({method:\'post\',url:\'/api/filedue\',data:{fileid:123},responseType:\'arraybuffer\'}).then((response)=>{this.download(response.data);})},download (data) {if (!data) {return}let url = window.URL.createObjectURL(new Blob([data]))let link = document.createElement(\'a\')link.style.display = \'none\'link.href = urllink.download = \'ea7c0cf24153e0cd62bc8b64841fd84d.jpg\'; //下载后文件名link.setAttribute(\'download\', \'ea7c0cf24153e0cd62bc8b64841fd84d.jpg\')document.body.appendChild(link)link.click()}
后端返回文件流即可