a标签啥都不做
<a :href=" item.feedBackFile ? baseUrl + item.feedBackFile : 'javascript:;'">
1、<a> 标签的 download 属性 下载文件
<a href="/images/myw3schoolimage.jpg" download="w3logo">
2、js方法
window.location.href -- (页面可能会出现移动,最好用a标签)
function openNewUrl(urlID){
window.location.href = href +"/message/exportWord?id="+urlID;
};
window.open(url,"_self");
downLoad(row) {
// console.log(row, "rowrowrowrowrow");
let obj = this.arrData[row.rowIndex];
let file = obj.feedBackFile;
let url = process.env.VUE_APP_API_BASEURL + file;
// let url = process.env.VUE_APP_API_BASEURL + "/profile/upload/2023/01/13/政治轮训反馈_20230113184125A001.xls";
if (file) {
window.open(url,"_self");
// window.location.href = process.env.VUE_APP_API_BASEURL + "/profile/upload/2023/01/13/政治轮训反馈_20230113184125A001.xls";
}
},
download() { if (!this.selectYear) { this.$message({ message: "请选择下载数据类型", type: "warning", offset: 50 }); } else if (this.selectYear === "1") { let url1 = this.baseurl + `/newZj/message/exportWord?id=${this.id}`; this.axios.get(url1).then(res1 => { if (res1.data) { window.location.href = url1; } else { this.$message({ message: "下载失败,没有相关数据", type: "warning", offset: 50 }