Skip to content

Instantly share code, notes, and snippets.

@lovemycodesnippets
Created February 7, 2025 17:49
Show Gist options
  • Save lovemycodesnippets/1d6e0c783ccb1119b97002ecc8f913a9 to your computer and use it in GitHub Desktop.
Save lovemycodesnippets/1d6e0c783ccb1119b97002ecc8f913a9 to your computer and use it in GitHub Desktop.
<template>
<div class="questions-ctr">
<div class="progress">
<div
class="bar"
:style="{
width: `${(questionsAnswered / questions.length) * 100}%`,
}"></div>
<div class="status">
{{ questionsAnswered }} out of {{ questions.length }} questions answered
</div>
</div>
<div
class="single-question"
v-for="(question, qi) in questions"
:key="question.id"
v-show="questionsAnswered === qi">
<div class="question">{{ question.question_text }}</div>
<div class="answers">
<div
class="answer"
v-for="answer in getAnswersForQuestion(question.id)"
:key="answer.answer_text"
@click.prevent="selectAnswer(answer.is_correct)">
{{ answer.answer_text }}
</div>
</div>
</div>
</div>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment