何从e何去

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

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) {})

  

 
posted on 2021-05-14 09:54  何从e何去  阅读(623)  评论(0编辑  收藏  举报