vue 或js 中解决 window.location.href下个多个文件只下载一个的问题, window.location.href不能同时下载多个文件问题解决
//下载试卷
downloadPapers() {
//接口参数
let obj = {
id: this.$route.query.code,
title: this.papersTitle, //试卷名称
}
//时间戳值
this.timestamp = this.getCurrentTimestamp()
//请求下载的接口
exportExam(obj).then((res) => {
if (res.code == 200) {
this.$message({
message: '下载成功!',
type: 'success',
})
console.log('下载', res)
res.data.forEach((file, index) => {
this.downloadFile(
file,
index == 0 ? this.timestamp + '试卷' : this.timestamp + '答案'
)
})
}
})
},
//阻止href多文件下载只下载一个问题方法
do