项目中调取高德地图天气接口
高德天气API调取接口axios.get("https://restapi.amap.com/v3/weather/weatherInfo?city='城市编码'&key='用户key'").then((res) => {res.data.lives.forEach((ele) => {this.temperature = ele.temperature;this
·
调取接口
axios
.get(
"https://restapi.amap.com/v3/weather/weatherInfo?city='城市编码'&key='用户key'"
)
.then((res) => {
res.data.lives.forEach((ele) => {
this.temperature = ele.temperature;
this.weather = ele.weather
});
})
.catch(console.log);
申请key时注意不要选择Web端(JS API)
更多推荐
已为社区贡献1条内容
所有评论(0)