【vue】后端接口返回了在预览中展示的png(二进制流)如何展示在前端页面?
代码
created() {
axios({
url: "http://localhost:8080/img/getimg",
responseType: "blob", //关键
}).then((res) => {
let data = new Blob([res.data]);
let url = window.URL.createObjectURL(data);
this.image = url; //image是图片的路径
});
},