从对象获取数据

问题描述 投票:0回答:1

我正在通过redux向app类发送请求响应。我在props中收到它,因为我可以在console.log(this.props.data);

但我得到了这个嵌套数组的对象

我试过console.log(this.props.data[0].PromiseValue); 导致undefined

[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: ""
javascript reactjs redux axios
1个回答
1
投票

你有没有尝试绑定承诺的“当时”事件?像这样的东西:

this.props.data[0].then(value => {
    console.log(value);
});
© www.soinside.com 2019 - 2024. All rights reserved.