js创建a标签下载download属性不起作用
downloadlink(){
let x = new XMLHttpRequest();
x.open("GET", url, true);
x.responseType = "blob";
x.onload = function (e) {
const url = window.URL.createObjectURL(x.response);
const a = document.createElement("a");
a.href = url;
a.download = fileName;
a.click();
};
x.send();
本文来自博客园,作者:懒惰ing,转载请注明原文链接:https://www.cnblogs.com/landuo629/p/14967326.html