java后台返回如图:

解决方法:
this.axios
.get("接口地址", {
responseType: "arraybuffer", //重要
params: 传给后端的数据
})
.then(response => {
return (
"data:image/png;base64," +
btoa(
new Uint8Array(response.data).reduce(
(data, byte) => data + String.fromCharCode(byte),
""
)
)
);
})
.then(data => {
this.imgUrl = data; //赋值给img标签的src属性
});
原文链接:https://blog.csdn.net/qq_37628661/article/details/104918677
最后
以上就是健壮鸡最近收集整理的关于Vue将后端返回的图片展示在img标签中的全部内容,更多相关Vue将后端返回内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复