diff --git a/view.js b/view.js index d61ca73..2231dda 100644 --- a/view.js +++ b/view.js @@ -69,13 +69,16 @@ app.component("view-mcq", { props: ["question", "translation", "answers", "answerTranslations", "indexOfCorrect"], data: function() { return { - toggle: false + toggle: false, + isRevealed: new Array(this.answers.length).fill(false) } }, methods: { - revealAll: function() { - for (i in this.$children) { - this.$children[i].hasBeenSelected = true; + reveal: function(i) { + if (this.indexOfCorrect == i) { + this.isRevealed.fill(true); + } else { + this.isRevealed[i] = true; } } }, @@ -83,16 +86,15 @@ app.component("view-mcq", {

{{ question }}

{{ translation }}

- +
` }); app.component("view-mcq-answer", { - props: ["answer", "answerTranslation", "isCorrect"], + props: ["index", "answer", "answerTranslation", "isCorrect", "isRevealed"], data: function() { return { - hasBeenSelected: false, toggle: false } }, @@ -101,10 +103,9 @@ app.component("view-mcq-answer", {

{{ answer }}

- - - - + + +

{{ answerTranslation }}