axios异步获取文件流数据


axios异步获取流程图片流文件进行图片

var _this = this
var url = _this.host
axios({
        method: 'GET',
        url: url,
        headers: {
          auth: _this.auth
        },
        responseType: 'arraybuffer'
      })
        .then((response) => {
          return (
            'data:image/png;base64,' +
            btoa(
              new Uint8Array(response.data).reduce(
                (data, byte) => data + String.fromCharCode(byte),
                ''
              )
            )
          )
        })
        .then((response) => {
          this.src = response
        })
        .catch(function (error) {})

  

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM