我正在尝试遍历每个对象具有动态长度的对象的值。
这是哈巴狗混合:
mixin gridContent(title,items,listName, gridType)
section(id=pageName class=listName)
div(class="grid-content grid-content--"+listName)
.container
h1.grid-content__title !{title}
ul.grid-content__list
li.grid-content__item
h1.item-title= item.title
div(class="item-content")
each item in items
p.item-description-title= item.content.link <-- works but only giving me 3 values I need the number of values in each object with its own dynamic count
这是我称为mixin和数组值的主要pug文件:
var servicesGrid = [
{
title: 'Accident',
content: {
link: 'Accident Benefits',
link: 'Car Accidents',
link: 'Bike Accidents',
link: 'Motorcycle Accidents',
link: 'Truck Accidents',
link: 'Slip and Fall Accidents',
link: 'Fatal Accidents',
}
},
{
title: 'Injury',
content: {
link: 'Dog Bites',
link: 'Brain and Spinal Cord Injury',
link: 'Personal Injury'
}
},
{
title: 'Other',
content: {
link: 'Medical Malpractice',
link: 'Nursing Home Abuse',
link: 'Civil Litigation',
link: 'Product Liability',
link: 'Second opinions',
link: 'WSIB Claims',
link: 'Wills and PoAs',
link: 'CPP Long Term Disabilities',
link: 'Bullying'
}
}
]
html
head
<meta charset="UTF-8">
<title>PC</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/png" href="/images/favicon.png">
<link rel="stylesheet" href="/main-45b6b7cf6ab0243c647f.css">
body
+gridContent('<span>What we stand for<span> <span class="type--color-green">our services</span>', servicesGrid, 'services', 'servicesGrid')
如何将每个链接放入列表中的每个
标记中?但是每个部分的动态数量呢?