vue 将图片流转换为 base64 的图片 src
getVerify() {let that = this;
axios({
method: "GET",
url: `http://192.168.7.61:3000/base/BaseApiService/createCaptchaCode?access_token=bjcenter`,
responseType: "arraybuffer", //这个在请求头里必须加
})
.then((res) => {
return (
"data:image/png;base64," +
btoa(
new Uint8Array(res.data).reduce(
(data, byte) => data + String.fromCharCode(byte),
""
)
)
);
})
.then((res) => {
that.verify = res;
console.log("res", res);
})
.catch((e) => {
console.log(e);
});
},
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
页:
[1]