generated from VLADIMIR/template_frontend
add main page
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
|
||||
type Application = {
|
||||
name: string
|
||||
}
|
||||
|
||||
type Team = {
|
||||
name: string
|
||||
spendTime: number
|
||||
applications: Application[]
|
||||
}
|
||||
|
||||
type Teams = {
|
||||
teams: Team[]
|
||||
}
|
||||
|
||||
const teams = ref<Teams>({teams: []})
|
||||
|
||||
function getTeams() {
|
||||
fetch(
|
||||
"/teams"
|
||||
)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
teams.value = data
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Ошибка:', error)
|
||||
});
|
||||
}
|
||||
|
||||
getTeams()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="header-block">
|
||||
Вечерний детектив
|
||||
</div>
|
||||
|
||||
<div v-for="team in teams.teams" :key="team.name">
|
||||
{{ team.name }}
|
||||
{{ team.spendTime }}
|
||||
{{ team.applications }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user