mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 01:58:29 +00:00
23 lines
551 B
TypeScript
23 lines
551 B
TypeScript
import Vue from 'vue';
|
|
import { Component, Lifecycle } from 'av-ts';
|
|
|
|
interface WeatherForecast {
|
|
dateFormatted: string;
|
|
temperatureC: number;
|
|
temperatureF: number;
|
|
summary: string;
|
|
}
|
|
|
|
@Component
|
|
export default class FetchDataComponent extends Vue {
|
|
forecasts: WeatherForecast[] = [];
|
|
|
|
@Lifecycle mounted() {
|
|
fetch('/api/SampleData/WeatherForecasts')
|
|
.then(response => response.json() as Promise<WeatherForecast[]>)
|
|
.then(data => {
|
|
this.forecasts = data;
|
|
});
|
|
}
|
|
}
|