nuxt-prawo-jazdy/pages/index.vue

57 lines
1,019 B
Vue

<script setup lang="ts">
useHead({
title: "Test na prawo jazdy",
});
const categories = [
"A",
"B",
"C",
"D",
"T",
"AM",
"A1",
"A2",
"B1",
"C1",
"D1",
"PT",
];
const loading = ref(false);
const examStore = useExamStore();
function setAndGo(category: string) {
loading.value = true;
examStore.setCategory(category);
while (true) {
if (examStore.category == category) {
return navigateTo("/exam");
}
}
}
</script>
<template>
<div>
<div v-if="!loading" class="text-3xl">
<span>Test na prawo jazdy</span>
<p>
Witaj w teście na prawo jazdy, aby rozpocząć, naciśnij jeden z
poniższych przycisków:
<br />
</p>
<div class="flex flex-row flex-wrap gap-2">
<button
class="btn btn-xl btn-secondary"
v-for="category in categories"
@click="setAndGo(category)"
>
{{ category }}
</button>
</div>
</div>
<Loading v-else />
</div>
</template>