<el-table-column prop="fileList" label="" align="center">
<template slot-scope="scope">
<a href="#" v-for="(item, index) in scope.row.fileList" :key="index">
<div
@click="downloadFiles(item.filePath, item.fileName)"
class="jcyjHover"
>
{{ item.fileName }}
</div>
</a>
</template>
</el-table-column>
downloadFiles(filePath, fileName) {
reward
.downloadFiles({ dto: { filePath: filePath, fileName: fileName } })
.then((res) => {
const content = res;
const blob = new Blob([content]);
if ("download" in document.createElement("a")) {
const elink = document.createElement("a");
elink.download = fileName;
elink.style.display = "none";
elink.href = window.URL.createObjectURL(blob);
document.body.appendChild(elink);
elink.click();
URL.revokeObjectURL(elink.href); // 释放URL 对象
document.body.removeChild(elink);
} else {
// IE10+下载
navigator.msSaveBlob(blob, fileName);
}
this.$message.success("下载成功");
})
.catch((res) => {
console.error(res.message);
this.loadingFlag = false;
});
},