js图片流转为blob和base64
this.$axios.post('接口', '参数',{
responseType:'blob'
}).then((res) => {
//转为blob
let blob = new Blob([res.data], {type: "image/png"});
let url = window.URL.createObjectURL(blob);
console.log(url)
//blob转为base64
var reader = new FileReader();
reader.readAsDataURL(blob);
reader.onload = function (e) {
console.log(e.target.result)
}
})