|
@@ -1,9 +1,9 @@
|
|
|
<template>
|
|
|
<div class="box">
|
|
|
- <p class="boxCity">{{weatcherData.city}}市</p>
|
|
|
- <p class="boxWeather">{{weatcherData.wea}}<br>
|
|
|
+ <p class="boxCity">{{weatcherData.city}}</p>
|
|
|
+ <p class="boxWeather">{{weatcherData.weather}}<br>
|
|
|
<label class="boxTemperature">
|
|
|
- {{weatcherData.tem}}°
|
|
|
+ {{weatcherData.humidity}}°
|
|
|
</label>
|
|
|
</p>
|
|
|
|
|
@@ -29,17 +29,17 @@
|
|
|
},
|
|
|
methods: {
|
|
|
getWeather() { // 第三方天气api接口
|
|
|
- axios.get('https://yiketianqi.com/free/day', {
|
|
|
+ axios.get('https://restapi.amap.com/v3/weather/weatherInfo', {
|
|
|
params: {
|
|
|
- unescape: "1",
|
|
|
- appid: '66192398',
|
|
|
- appsecret: 'cqIyJ5ZP',
|
|
|
+ key: "3e7e20b74481bb09b90dade55acc35c3",
|
|
|
+ city: '370100',
|
|
|
+ output: 'JSON',
|
|
|
// version: 'v91'
|
|
|
}
|
|
|
}).then(res => {
|
|
|
- console.log('555', res.data);
|
|
|
- if (res.data) {
|
|
|
- this.weatcherData = res.data;
|
|
|
+
|
|
|
+ if (res.data.lives) {
|
|
|
+ this.weatcherData = res.data.lives[0];
|
|
|
}
|
|
|
}).catch(err => {
|
|
|
console.log(err)
|