关于element-ui 下载文件的代码
在这里插入代码片
在操作栏那边有个下载的点击事件
@click="downLoad()"
//然后在方法里面这么写
downLoad(row) {
console.log(row);
console.log(row.url);
const alink = document.createElement("a");
const blob = new Blob([row.url], { type: "application/xml" });
alink.href = URL.createObjectURL(blob);
alink.setAttribute("download", row.fileName);
document.body.appendChild(alink);
alink.click();
document.body.removeChild(alink);
window.URL.revokeObjectURL(alink.href);
},