Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

105
Views
Pug aumenta el número 'dentro' del nombre de la matriz

Estoy usando PUG y tengo matrices como se muestra a continuación

 -let filter0 = ['Category', 'Brand', 'Price', 'Color'] -let filter1 = ['Category 1', 'Category 2', 'Category 3'] -let filter2 = ['Brand 1', 'Brand 2'] -let filter3 = ['Price 1', 'Price 2'] -let filter4 = ['Color 1', 'Color 2']

filter0 define mis títulos.

El resto ( filter# ) define las subcategorías de cada título.

Quiero aumentar el nombre de la matriz en cada bucle igual que los nombres de clase.

 each val, index in filter0 input(class='toggle' id='toggle'+index type='checkbox') label.title(for='toggle'+index) = val .content each val, index in filter1 // This should be filter+index so the result can be filter1,filter2 etc. ul li input(class='checkbox' id='checkbox-'+index type='checkbox' value='value'+index) label(for='checkbox-'+index)= val

es posible? ¡Gracias!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Para cualquiera que quiera ver la solución por alguna razón: P Gracias @AminTaghikhani

 var filter = { 0: ['Category', 'Brand', 'Price', 'Color'], 1: ['Category 1', 'Category 2', 'Category 3'], 2: ['Brand 1', 'Brand 2'], 3: ['Price 1', 'Price 2'], 4: ['Color 1', 'Color 2'] }
 each x, y in filter[0] input(class='toggle' id='toggle'+y type='checkbox') label.title(for='toggle'+y) = x .content each a, b in filter[1+y] ul li input(class='checkbox' id='checkbox-'+b+y type='checkbox' value='value'+b+y) label(for='checkbox-'+b+y)= a
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!