0
点赞
收藏
分享

微信扫一扫

Cesium离线部署影像+地形:从0到1

夜空一星 2024-06-11 阅读 11
   try {
       const response = await request.get(checkCodeUrl.value,{responseType:"arraybuffer"});
      console.log("验证码请求成功:", response);
   checkCodeUrl.value = `data: image/jpeg;base64,${btoa(new Uint8Array(response).reduce((data, byte) => data + String.fromCharCode(byte), ''))}`;
     } catch (error) {
         console.error("验证码请求失败:", error);
    }

接口上面的responseType设置成为buffer即可

(new Uint8Array(response)-----这里的response替换成为自己的乱码内容所对应的是后端返回的哪一个具体位置

举报

相关推荐

0 条评论