• 请求时要设置responseType为"arraybuffer";
             httpService.accessAPI({
                    apiObj:apiUrl.getQrCodePicture,
                    responseType:"arraybuffer",
                    query:{
                        qrCodeName:this.chooseItems[0].id,
                    },
                }).then(result => {
                    this.srcImg='data:image/jpg;base64,'+ btoa(new Uint8Array(result).reduce((data, byte) => data + String.fromCharCode(byte), ''));
                    let link = document.createElement('a');
                    link.href = this.srcImg;
                    link.download = "qrCode.jpg";
                    link.click();

                })
 <img :src = "srcImg" alt="">
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐