const req = new XMLHttpRequest()
req.open('GET','/xxx/xxx', true)
req.responseType = 'blob'
req.setRequestHeader('Content-Type', 'application/json')
req.onload = function () {
    const data = req.response
    const blob = new Blob([data])
    const blobUrl = window.URL.createObjectURL(blob)
    const a = document.createElement('a')
    a.style.display = 'none'
    a.download = 'aaa.pdf'
    a.href = blobUrl
    a.click()
}
req.send()

想妳就寫信
31 声望1 粉丝