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; }