From fa81e34f3173dd9545d3d79d14ec4deaf09cf846 Mon Sep 17 00:00:00 2001 From: ZhangXianQiang <1135831638@qq.com> Date: 星期一, 01 七月 2024 11:22:23 +0800 Subject: [PATCH] fix:修改多选题回显问题 --- src/views/exam/components/answer-main/answer-single/index.vue | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/views/exam/components/answer-main/answer-single/index.vue b/src/views/exam/components/answer-main/answer-single/index.vue index 278269e..8563967 100644 --- a/src/views/exam/components/answer-main/answer-single/index.vue +++ b/src/views/exam/components/answer-main/answer-single/index.vue @@ -35,13 +35,20 @@ item.isActive = true; } const answerList = filterAnswer(); - examStore.setQuestionAnswer(currentType.value, currentIndex.value, answerList.join(',')); + let temp = ''; + if(answerList) { + temp = answerList.prefix; + } + examStore.setQuestionAnswer(currentType.value, currentIndex.value, temp); } }; const answerState = (item) => { + if(activeQuestion.value.answer === item.prefix) { + item.isActive = true; + } return { - active: item.isActive + active: item.isActive || item.prefix === activeQuestion.value.answer }; }; @@ -50,7 +57,7 @@ }; const filterAnswer = () => { - return activeQuestion.value.questionItemList.filter(item => item.isActive); + return activeQuestion.value.questionItemList.find(item => item.isActive); } -- Gitblit v1.8.0