Note 笔记
Opened this issue · 1 comments
PaulChess commented
一些随手记
PaulChess commented
fetch 函数:
fetch('xxx', {
method: 'post',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({"query":"{bondService(commonInput:{codes:\"33(300033)\"}){bond_name bond_seccode}}"})
})
.then(v => v.json())
.then((response) => {
console.log('response====')
console.log(response.data.bondService)
})
headers 里需要加 Accept: 'application/json'
, 才能拿到实际返回的数据,否则 response 打印出来始终是个 promise