diff --git a/src/components/Question.vue b/src/components/Question.vue index 51f1bd9..24bb032 100644 --- a/src/components/Question.vue +++ b/src/components/Question.vue @@ -18,6 +18,7 @@ const questionList = ref(data); //随机打乱题库 const isChecked = ref(false); const checkedOption = ref(""); const QaResult = ref(1); //当前答题结果 +const correctObj = ref({}); //当前正确选项 // 答题事件 const answerFn = (item, event) => { @@ -29,6 +30,13 @@ const answerFn = (item, event) => { checkedOption.value = item; console.log("checkedOption", checkedOption.value); QaResult.value = item.result; + + // 设置正确选项 + correctObj.value = questionList.value[currentId.value].answer.find( + (item) => item.result == 1 + ); + console.log("correctObj", correctObj.value); + gsap.to(".qp-result ", { duration: 0.5, autoAlpha: 1, delay: 1 }); }); }; @@ -176,14 +184,22 @@ const getClass = (item) => {