前端展示文件流图片
发表于:2022-04-11 | 分类: 前端
字数统计: 104 | 阅读时长: 1分钟 | 阅读量:
代码如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<template>
//随便搞一个容器
<img id="img1" :src="imageUrl1" alt="" style="width: 700px"/>
</template>
<script>
data(){
return{
imageUrl1:'',
}
}
mounted(){
this.initImage();
}
method(){
initImage(){
this.axiosFun()
.then(function (response) {
var blob = new Blob([response]); //创建一个blob对象
//下面这一行为重点!!!!!!!!!!!!!!!!!!
this.imageUrl1 = window.URL.createObjectURL(blob);
})
.catch(function (err) {
console.log(err);
});
}
}
</script>
上一篇:
ElementVue分页组件二次封装
下一篇:
从服务器指定路径下载文件