接口
export function getDownload(formData) {
return request({
url: "",
method: "get",
responseType: "blob",
params: formData,
});
}
引入接口
getDownload(this.form).then(({data})=>{
let blob = new Blob([data], {
type: "application/vnd.ms-excel",
});
let objectUrl = URL.createObjectURL(blob);
let a = document.createElement("a");
a.href = objectUrl;
a.download = "555"; // 文件名 ,
a.click();
})