fetch("/api/api/AuthenticationLogin/getQuickResponseCode", {
method: "post",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
apiId: "e53f2682fe6fd77c5fd25841ec1170ef",
apiSecret: "abe93f28d5c74b0ea2664f9869946d79",
apiType: "channel",
loginUUID: "6f2ab5a8df5b4259a6e8e2c8644ea8fd",
}),
})
.then((res) => {
return res.blob();
})
.then((res) => {
console.log("==================>");
console.log(res);
let read = new FileReader()
// 通过文件流对象将文件流转换为字符串,再通过JSON.parse 转换为json对象
read.readAsText(res,'utf-8')
read.onload = (data)=>{
console.log(JSON.parse(data.currentTarget.result));
}
this.QRCode = URL.createObjectURL(res);
// 轮询
this.poll();
});
JS 二进制流转换为JSON对象
最新推荐文章于 2024-07-28 03:07:52 发布