From ba8443dca64ce1332edab1bca22d038f6b964fec Mon Sep 17 00:00:00 2001 From: Simon C Date: Wed, 6 Apr 2022 12:32:04 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20Selection=20de=20la=20premi=C3=A8re=20r?= =?UTF-8?q?=C3=A9ponse=20automatiquement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Question.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/Question.vue b/src/components/Question.vue index 94c569c..e5f2f08 100644 --- a/src/components/Question.vue +++ b/src/components/Question.vue @@ -12,7 +12,11 @@ const props = defineProps({ defineEmits(["answerSelected"]); const slides = ref(); -const answerWeight = ref(props.question.answers[0].weight); + +if (props.question.weight == null) { + props.question.weight = props.question.answers[0].weight +} +const answerWeight = ref(props.question.weight); function selectAnswer(answer) { const answerIndex = props.question.answers.findIndex( @@ -20,8 +24,9 @@ function selectAnswer(answer) { ); slides.value.splide.go(answerIndex); } + function slideMove(splide, newIndex) { - answerWeight.value = props.question.answers[newIndex].weight; + props.question.weight = props.question.answers[newIndex].weight; }