其他分享
首页 > 其他分享> > vue 下载阿里云OSS远程图片,跨域问题, No 'Access-Control-Allow-Origin' header is present on the requested

vue 下载阿里云OSS远程图片,跨域问题, No 'Access-Control-Allow-Origin' header is present on the requested

作者:互联网

downloadIamge(imgsrc, name) {
  const src = `${imgsrc}?t=${new Date().getTime()}`
  fetch(src).then(res => {
    res.blob().then(myBlob => {
      const href = URL.createObjectURL(myBlob)
      const a = document.createElement('a')
      a.href = href
      a.download = name
      a.click()
      a.remove()
    })
  })     
}

标签:Control,requested,const,name,res,myBlob,Access,href,imgsrc
来源: https://www.cnblogs.com/gesheng/p/15547409.html