I’m trying to “create” a template using “Json” in Pug, but there is a point where I need to put much Information. But the problem for me becomes where I need to read an element deeply inside.
-
var SuperSlidersInfo = {
'numero': '4',
'sectionName': 'Dignidad',
'video': true,
'youtube': [
'idVideo',
'idVideo2',
],
'notes':[
['prueba1', 'prueba2'],
['segundo1', 'segundo2', 'segundo3'],
],
'img': [
'NombreImagen',
'NombreImagen2',
],
'extension': 'jpg',
'titulo': [
'Titulo',
],
'parrafo': [
'Texto',
]}
+SuperSlidersPug(SuperSlidersInfo)
mixin SuperSlidersPug(SuperSlidersInfo)
.container-pc
.container-sliderAutomatico.no-phone
div(id=`sliderAutomatico${SuperSlidersInfo.numero}` class= SuperSlidersInfo.video ? "dosVideos-container" : "otraCosa").sliderAutomatico
each imgName, index in SuperSlidersInfo.img
//- div(class= SuperSlidersInfo.video ? "dosVideos").sliderAutomatico__section
div(class= SuperSlidersInfo.video ? "dosVideos" : "otraCosa").sliderAutomatico__section
.swiper-content
if SuperSlidersInfo.video
.section_videoContainer
a(href=`#video${SuperSlidersInfo.sectionName}${index}`).section_videoThumbnail--Container
img(src=`${imgURL}${SuperSlidersInfo.sectionName}${index + 1}.${SuperSlidersInfo.extension}`, alt="")
h3.swiper-content_titulo= `${SuperSlidersInfo.titulo[index]}`
.section_video--notes
//- -----------------
//- Problem
//- -----------------
//- the "a" below works, but I need to "create" and each, or for, or any loop for to put all the elements in that especific array.
//- a(href=`${SuperSlidersInfo.notes[index]}`).section_video--note
//- The "each" below it suppose to works. But when I put the "[index]" it brokes..
each note, noteIndex in SuperSlidersInfo.notes[index]
a(href=`${note}`).section_video--note
For general elements it works well. But when I need to read the “notes”. It’s impossible por me.
But when I put each note, noteIndex in SuperSlidersInfo.notes[index]
everything is broken…
So I need to read the “elements” that “note” has in its array…
//- Works well
each note, noteIndex in SuperSlidersInfo.notes
//- It's Broke
each note, noteIndex in SuperSlidersInfo.notes[index]
the index
is from the each
that exist almost at top of the code