// 下载文件
export function downFile(id,filename) {
return request({
url: `xxx/${id}`,
method: 'get',
responseType: 'blob',
}).then((res) => {
var blob = new Blob([res.data])
console.log(blob)
var downloadUrl = window.URL.createObjectURL(blob)
var anchor = document.createElement('a')
//anchor.style.display = "none";
anchor.href = downloadUrl
// 这里的filename 带有后缀,能决定文件的类型
anchor.setAttribute("download", filename);
document.body.appendChild(anchor)
anchor.click()
document.body.removeChild(anchor)
//window.URL.revokeObjectURL(data)
}
)
}