improved display

This commit is contained in:
Thomas
2018-09-06 20:32:25 +02:00
parent 7d8008138b
commit 663e856e1f
2 changed files with 47 additions and 42 deletions
+23 -8
View File
@@ -17,12 +17,24 @@
</v-card>
</v-flex>
<v-flex xs10 class="mt-3">
<v-card>
<v-card v-if="show">
<v-card-text>
<h1>{{temp}}°F</h1>
<p>Min Temperature : {{ tempMin }}</p>
<p>Max Temperature : {{ tempMax }}</p>
<p>Humidity : {{ humidity }}</p>
<v-layout row>
<v-layout xs6>
<v-card-text>
<v-spacer></v-spacer>
<h1>{{temp.toFixed(2)}}°C</h1>
<h1>{{weatherDescription}}</h1>
</v-card-text>
</v-layout>
<v-layout xs6>
<v-card-text>
<p><v-icon>fas fa-snowflake</v-icon>Min : {{ tempMin.toFixed(2) }}°C</p>
<p><v-icon>fas fa-sun</v-icon>Max : {{ tempMax.toFixed(2) }}°C</p>
<p><v-icon>fas fa-tint</v-icon>Humidity : {{ humidity }} %</p>
</v-card-text>
</v-layout>
</v-layout>
</v-card-text>
</v-card>
</v-flex>
@@ -45,6 +57,7 @@
tempMin: null,
tempMax: null,
humidity: null,
show: false,
key: '863668499362fb4884ebd97229f3b26b',
url: 'http://api.openweathermap.org/data/2.5/weather'
}
@@ -61,10 +74,12 @@
}
}).then(response => {
console.log(response.data)
this.temp = response.data.main.temp
this.tempMax = response.data.main.temp_max
this.tempMin = response.data.main.temp_min
this.temp = response.data.main.temp - 274
this.tempMax = response.data.main.temp_max - 274
this.tempMin = response.data.main.temp_min - 274
this.humidity = response.data.main.humidity
this.weatherDescription = response.data.weather[0].description
this.show = true
}).catch(errors => {
console.log(errors)
})