从对象获取数据

时间:2019-04-01 18:33:02

标签: javascript reactjs redux axios

我正在通过Redux向应用类发送请求响应。 而且我可以通过console.log(this.props.data);在道具中收到它。

但是我得到了一个充满对象的嵌套数组

我尝试过 console.log(this.props.data[0].PromiseValue); 导致未定义

[Promise]
0: Promise
__proto__: Promise
[[PromiseStatus]]: "resolved"
[[PromiseValue]]: Object
config: {adapter: ƒ, transformRequest: {…}, transformResponse: {…}, timeout: 0, xsrfCookieName: "XSRF-TOKEN", …}
data: (10) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
headers: {pragma: "no-cache", content-type: "application/json; charset=utf-8", cache-control: "public, max-age=14400", expires: "Mon, 01 Apr 2019 22:25:19 GMT"}
request: XMLHttpRequest {onreadystatechange: ƒ, readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, …}
status: 200
statusText: ""

1 个答案:

答案 0 :(得分:1)

您是否尝试过绑定诺言的“然后”事件?像这样:

this.props.data[0].then(value => {
    console.log(value);
});