java+VUE,下载文件,前端接受的问题。

downloadExcel(param).then(res => {
let link = document.createElement(‘a’);
link.href = window.URL.createObjectURL(res);
var filename = “调查问卷.xlsx”;
link.download = filename;
link.click();
});
downloadExcel,后台的方法,访问方法,返回res,生成标签,模拟点击,下载该文件。
downloadExcel,返回的是ResponseEntity<byte []>

猜你喜欢

转载自blog.csdn.net/qq_42633661/article/details/84875185