1、应项目要求,后台返回二进制流,而且乱码

2、红色为必须

this.$axios.post('/fishweb/agent/downLoad',this.stringify({filename:'qrCode.jpg'}), {
        responseType: 'arraybuffer' //指定返回数据的格式为blob
      }).then((res) => {
        var src='data:image/jpg;base64,'+ btoa(new Uint8Array(res).reduce((data, byte) => data + String.fromCharCode(byte), ''));
        this.srcImg = src; //图片回显
        var link = document.createElement('a');
        link.href = src;
        link.download = "qrCode.jpg";
        link.click();
      })

 

Logo

前往低代码交流专区

更多推荐