从后端获取图片转blob为什么失败?用unit8array转换显示大小为0 但是后端图片资源是获取成功的 可以正常预览 这可能是什么原因?前端是vue3 后端是springboot3.2.2 java版本是21 后端返回代码如下: public byte[] getImages(String URL) throws IOException { try (FileInputStream inputStream = new FileInputStream(new File(FilePath + URL))) { byte[] bytes = new byte[inputStream.available()]; inputStream.read(bytes, 0, inputStream.available()); return bytes; } } 前端请求代码如下: const config = { headers: { Authorization: `Bearer ${this.$store.getters.getToken}`, responseType: "arraybuffer", accept: "image/jpeg", }, }; send .get(`/images/avatars/${this.$store.getters.getAvatar}`, config) .then((response) => { console.log(response.data); const uint8Array = new Uint8Array(response.data); console.log(uint8Array); const blob = new Blob([response.data], { type: "image/jpeg" }); console.log(blob); const url = window.URL.createObjectURL(blob); this.avatarURL = url; }); 前端网络返回资源如下: 前端打印的信息: 网页和地址栏预览图片不显示: 纠缠了ai几个小时,搜索了与我类似的情况,尝试不使用accept,或者把responseType的"blob"换成"arraybuffer",不使用responseType,以及把arraybuffer格式化成Uint8Array,把URL.createObjectURL换成window.URL.createObjectURL,但是都不起左右 补充:看到ai的回答,打印了一下response.data的类型,是string,但是我后台返回的是byte[],请求头填的responseType是"blob",没一个对的上,这是否是正常的?另外还打印了一下arraybuffer和blob的类型,发现是对象,这就没办法参考了,c语言里面string是拿char[]模拟的,所以这返回的类型是string是否是正常的?