第一步
npm install js-file-download
第二步
import fileDownload from 'js-file-download'
axios.get(`/operation/ruleImport/template`, {
responseType: 'blob' //返回的数据类型
})
.then(res => {
fileDownload(res.data, this.fileName)//this.fileName你需要的文件名,要带后缀
})
版权声明:本文为Godingchen原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。