【发布时间】:2016-12-17 06:18:54
【问题描述】:
我有一个像这样的数组:
[
a: [
{
"id" : "1"
"val" : "sharedVal1"
},
{
"id" : "2"
"val" : "sharedVal1"
},
]
b: [
{
"id" : "3"
"val" : "sharedVal2"
},
{
"id" : "4"
"val" : "sharedVal2"
},
]
c: [
...
]
]
如何在 Jade 中渲染它?我目前的尝试看起来像
each city in cities
h2 asdf
each foo in city
.col-md-4
.row.bottomPadding
.col-md-3
img(src='#{foo.logo_image_url}')
.col-md-9.text-nowrap
p.nav.hide-overflow #{foo.name}
目前没有渲染。如果我只是传入扁平(未预处理)数组并执行单个each x in y,它会呈现良好。
【问题讨论】:
-
发布您如何为玉提供数据。您的 gulp/grunt 配置或您如何调用 api
-
@Daniel_L 更新了 OP。
-
“如果我只是传入扁平(未预处理)数组”你是怎么做到的,发布你的代码
-
您的“数组”无效;您在这里使用了混合对象表示法和数组结构,这可能不是您的意思。
标签: javascript node.js pug