我想得到一个 json 文件作为回报。
这是我正在使用的提取函数
handleApi(){
return
fetch('https://facebook.github.io/react-native/movies.json')
.then((response) => response.json())
.then((responseJson) => {
return responseJson.movies;
})
}
Run Code Online (Sandbox Code Playgroud)
正在按钮单击事件上调用此函数。
handleSubmit() {
console.log(
this.handleApi();
)
Run Code Online (Sandbox Code Playgroud)
但我得到这个 Promise对象作为回报不是预期的数据
Promise {_40: 0, _65: 0, _55: null, _72: null}_40: 0_55: null_65: 0_72: null__proto__: Object