// 获取验证码图片
getCode().then((res) => {
const status=res.status
const data=res.data
// console.log(status,data);
if (status == 200) {
//后端返回的验证码图片数据 前端转换为图片
const img = btoa(
new Uint8Array(data).reduce(
(data, byte) => data + String.fromCharCode(byte),
""
)
);
this.imgs = "data:image/png;base64," + img;
}
// console.log(this.imgs);
});
后端验证码图片代码,前端转换为图片
最新推荐文章于 2023-03-20 11:44:09 发布