代码:
export default {
/**
* 下载文件
*/
exportFile: (fileUrl) => {
if (fileUrl) {
let exportFrame = document.querySelector("#exportFrame");
if (exportFrame) {
document.body.removeChild(exportFrame);
}
exportFrame = document.createElement("iframe");
exportFrame.id = "exportFrame";
exportFrame.style.cssText = "display: none";
exportFrame.onload = function() {
document.body.removeChild(exportFrame);
}
exportFrame.src = fileUrl;
document.body.appendChild(exportFrame);
}
}
}
.