Answer the question
In order to leave comments, you need to log in
How to make jade mixin for menu with sub items?
You need to make a minsin so that it is generated in this markup
Answer the question
In order to leave comments, you need to log in
In fact, it is not very convenient due to the fact that the array needs to be lined up in one line. Maybe someone else can suggest a solution.
each item in newsList
li
a #{item.name}
each subitem in item.sub
ul
li
a #{subitem}
- var newsList = [{name : 'Пункт 1', sub: ['Пункт 1.1', 'Пункт 1.2', 'Пункт 1.3', 'Пункт 1.4']}]
- var newsList2 = [{name : 'Пункт 2', sub: ['Пункт 2.1', 'Пункт 2.2', 'Пункт 2.3', 'Пункт 2.4']}]
mixin list(items)
ul
each item in items
li
a #{item.name}
each subitem in item.sub
ul
li
a #{subitem}
+list(newsList)
+list(newsList2)
each item in menu
+list(item)
The array does not have to be in 1 row
-
var newsList = [
{name : 'Пункт 1', sub: ['Пункт 1.1', 'Пункт 1.2', 'Пункт 1.3', 'Пункт 1.4']},
{name : 'Пункт 2', sub: ['Пункт 2.1', 'Пункт 2.2', 'Пункт 2.3', 'Пункт 2.4']}]
- var newsList = [
- {name : 'Пункт 1', sub: ['Пункт 1.1', 'Пункт 1.2', 'Пункт 1.3', 'Пункт 1.4']},
- {name : 'Пункт 2', sub: ['Пункт 2.1', 'Пункт 2.2', 'Пункт 2.3', 'Пункт 2.4']}]
each item in newsList
li
a #{item.name}
each subitem in item.sub
ul
li
a #{subitem}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question