Skip to content

Instantly share code, notes, and snippets.

@lovemycodesnippets
Created February 7, 2025 17:50
Show Gist options
  • Save lovemycodesnippets/46c08b3196971f14c15186a48a8b9764 to your computer and use it in GitHub Desktop.
Save lovemycodesnippets/46c08b3196971f14c15186a48a8b9764 to your computer and use it in GitHub Desktop.
From the article "Building a Quiz App with Nuxt and Xata"
<script setup>
const reset = () => {
totalCorrect.value = 0;
questionsAnswered.value = 0;
};
</script>
<template>
<main>
<div class="ctr">
<Questions
v-if="questionsAnswered < questions.length"
:questions="questions"
:answers="answers"
:questionsAnswered="questionsAnswered"
@question-answered="questionAnswered" />
<Result v-else />
<button
type="button"
class="reset-btn"
v-if="questionsAnswered === questions.length"
@click.prevent="reset">
Reset
</button>
</div>
<Footer />
</main>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment