利用a标签的download属性下载文件
function downloadFile(obj, name, suffix) { const url = window.URL.createObjectURL(new Blob([obj])) const link = document.createElement('a') link.style.display = 'none' link.href = url const fileName = parseTime(new Date()) + '-' + name + '.' + suffix link.setAttribute('download', fileName) document.body.appendChild(link) link.click() document.body.removeChild(link) }