From 7c767a5ba9f0572ce3aacf8f3aeed4bb6ffeb45c Mon Sep 17 00:00:00 2001 From: NgoQuocViet2001 Date: Sun, 9 Aug 2026 00:37:31 +0700 Subject: [PATCH] fix: support variable quiz question counts --- etc/quiz-app/src/components/Quiz.vue | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/etc/quiz-app/src/components/Quiz.vue b/etc/quiz-app/src/components/Quiz.vue index 9734ec92..9c9b6c15 100644 --- a/etc/quiz-app/src/components/Quiz.vue +++ b/etc/quiz-app/src/components/Quiz.vue @@ -21,7 +21,7 @@ :key="index" v-for="(option, index) in quiz.quiz[currentQuestion] .answerOptions" - @click="handleAnswerClick(option.isCorrect)" + @click="handleAnswerClick(option.isCorrect, quiz.quiz.length)" class="btn ans-btn" > {{ option.answerText }} @@ -62,12 +62,11 @@ export default { }, methods: { - handleAnswerClick(isCorrect) { + handleAnswerClick(isCorrect, questionCount) { this.error = false; let nextQuestion = this.currentQuestion + 1; if (isCorrect) { - //always 3 questions per quiz - if (nextQuestion < 3) { + if (nextQuestion < questionCount) { this.currentQuestion = nextQuestion; } else { this.complete = true;