get请求后端返回的是Content-Type: image/jpeg,前端如何展示图片

问题 Content-Type: image/jpeg,前端何如处理图片

image/jpeg
response里啥也没有,不通过返回图片地址的方式将图片给前端

在这里插入图片描述
在Preview中能看到完整的图片
在这里插入图片描述

处理方法

在Preview中鼠标右键点击图片,选择复制图片地址(Copy image url)

将这个地址放到img标签的src属性就可以正常显示图片
在实际开发中,我们需要自己去拼凑出这个地址

 <img
   src={
    
    `${
      
      window.location.protocol}//${
      
      window.location.host}/api/v1/imageinfo/qrcode?content=${
      
      ShareUrl}&height=244&width=244`}
   alt=""
   width="248px"
   height="244px"
   style={
    
    {
    
    
     marginTop: '10px',
   }}
 />

猜你喜欢

转载自blog.csdn.net/glorydx/article/details/113944688