1
  if ('msSaveOrOpenBlob' in navigator) { // 兼容edge
    window.navigator.msSaveOrOpenBlob(blob, fileName)
  } else if ('download' in document.createElement('a')) { // chrome等
    const aLink = document.createElement('a')
    aLink.href = URL.createObjectURL(blob)
    aLink.setAttribute('download', fileName) // 设置下载文件名称
    document.body.appendChild(aLink)
    aLink.click()
    document.body.removeChild(aLink)
    window.URL.revokeObjectURL(aLink.href)
  } else { // 兼容IE10+
    window.navigator.msSaveBlob(blob, fileName)
  }

AlannnnnnL
206 声望5 粉丝