调取接口
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)