JSON preguntas corregido

This commit is contained in:
María
2025-10-21 15:18:17 +02:00
committed by María
parent ddc623411a
commit da5b74b295
12 changed files with 3577 additions and 81 deletions

View File

@@ -1,5 +1,5 @@
<template>
<FormSlice :type="currentSlice.type">
<FormSlice :id="currentSlice.id" :type="currentSlice.type">
<template v-if="currentSliceComponent">
<transition name="fade" mode="out-in">
<component
@@ -103,6 +103,7 @@ export default {
},
goToNext(event) {
console.log("Evento recibido para ir al siguiente slice:", event)
if (this.currentSlice.type === "question" && event !== undefined) {
const answerObj = {
sectionId: this.currentSlice.section.id,
@@ -116,7 +117,7 @@ export default {
}
const nextConfig = this.currentSlice.next
//console.log("Navegando desde slice:", this.currentSliceId, "con configuración next:", nextConfig)
console.log("Navegando desde slice:", this.currentSliceId, "con configuración next:", nextConfig)
if (!nextConfig) {
////console.log("Encuesta finalizada", this.answers)
return
@@ -128,13 +129,15 @@ export default {
previousSlices.push(this.currentSliceId)
localStorage.setItem('previous-slices', JSON.stringify(previousSlices))
}
if (typeof nextConfig === "string") {
// Navegación lineal
console.log("--- Navegación LINEAL (string) al slice:", nextConfig)
this.currentSliceId = nextConfig
} else if (typeof nextConfig === "object") {
// Navegación condicional por valor de respuesta
const nextSlice = nextConfig[event]
console.log("--- Navegación CONDICIONAL (object) al slice:", nextConfig)
const nextSlice = nextConfig[event.value]
if (nextSlice) {
this.currentSliceId = nextSlice
} else {