AJAX 根据URL多文件下载
DownLoad() { const that = this; const result = "http://" + window.location.host + "/Upload/" let files = that.DownLoadUrl.split(";") //分号分割的url地址 files.forEach(url => { let dowmUrl = result + url; that.getFileAndDownload(dowmUrl); }) }, getFileAndDownload(url) { let x = new XMLHttpRequest(); x.open('GET', url, true) x.responseType = 'blob' x.onload = function (e) { const fileName = url.substring(url.lastIndexOf("/") + 1, url.length); const blob = x.response if ('msSaveOrOpenBlob' in navigator) { window.navigator.msSaveOrOpenBlob(blob, fileName) } else { var a = document.createElement('a') a.download = fileName; a.href = URL.createObjectURL(blob); $('body').append(a); a.click(); $(a).remove(); } } x.send(); },