feat: Selection de la première réponse automatiquement
This commit is contained in:
parent
5fc23225d0
commit
ba8443dca6
|
@ -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;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in New Issue