nuxt-prawo-jazdy/pages/index.vue
NetMan c99576617b many minor fixes:
nuxtimg, categories composabled, tailwind config in js, remove comments, next question operation, media fit
2025-04-28 13:11:07 +02:00

47 lines
1,013 B
Vue

<script setup lang="ts">
import categories from '~/categories';
onMounted(() => {
useHead({
title: 'Test na prawo jazdy',
});
});
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
v-for="category in categories"
:key="`btn-${category}`"
class="btn btn-xl btn-secondary"
@click="setAndGo(category)"
>
{{ category }}
</button>
</div>
</div>
<LoadingScreen v-else />
</div>
</template>