Open openks opened 6 years ago
在then
里做如下处理是可以的
let reader = response.body.getReader();
let decoder = new TextDecoder();
let str=''
reader.read().then(function(result) {
str=decoder.decode(result.value)
_this.setState({'imgsrc': str});
})
处理基本的Text/HTML响应
fetch('/imageCode', {
method: 'GET',
mode: 'cors',
})
.then((response) => response.text())
.then((txt)=>{
console.log(txt)
})