Add project files.

This commit is contained in:
Karolis2011
2021-08-09 20:46:45 +03:00
parent f5e18022ed
commit e498f41f95
26 changed files with 12941 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
<template>
<h1 id="tableLabel">Weather forecast</h1>
<p>This component demonstrates fetching data from the server.</p>
<p v-if="!forecasts"><em>Loading...</em></p>
<table class='table table-striped' aria-labelledby="tableLabel" v-if="forecasts">
<thead>
<tr>
<th>Date</th>
<th>Temp. (C)</th>
<th>Temp. (F)</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
<tr v-for="forecast of forecasts" v-bind:key="forecast">
<td>{{ forecast.date }}</td>
<td>{{ forecast.temperatureC }}</td>
<td>{{ forecast.temperatureF }}</td>
<td>{{ forecast.summary }}</td>
</tr>
</tbody>
</table>
</template>
<script>
import axios from 'axios'
export default {
name: "FetchData",
data() {
return {
forecasts: []
}
},
methods: {
getWeatherForecasts() {
axios.get('/weatherforecast')
.then((response) => {
this.forecasts = response.data;
})
.catch(function (error) {
alert(error);
});
}
},
mounted() {
this.getWeatherForecasts();
}
}
</script>