显示的代码是从object
返回的API
。例如,如何访问data
和coord
?
Promise {<resolved>: {…}}
__proto__: Promise
[[PromiseStatus]]: "resolved"
[[PromiseValue]]: Object
config: {adapter: ƒ, transformRequest: {…}, transformResponse: {…}, timeout: 0, xsrfCookieName: "XSRF-TOKEN", …}
data:
base: "stations"
clouds: {all: 40}
cod: 200
coord: {lon: -74.17, lat: 40.55}
dt: 1558987860
id: 5096316
main: {temp: 299.92, pressure: 1013, humidity: 32, temp_min: 298.15, temp_max: 301.48}
name: "Carteret"
rain: {1h: 0.51}
sys: {type: 1, id: 4686, message: 0.0095, country: "US", sunrise: 1558949467, …}
timezone: -14400
visibility: 16093
weather: [{…}]
wind: {speed: 3.1, deg: 340}
__proto__: Object
headers: {content-type: "application/json; charset=utf-8"}
request: XMLHttpRequest {onreadystatechange: ƒ, readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, …}
status: 200
statusText: "OK"
__proto__: Object
我尝试了Promise.data.coords
,但是没有用。