我使用带有Jade和ss-hogan的Socketstream默认堆栈作为模板。我喜欢它,除了我不知道怎么打印列表。示例:
client.js
html = ss.tmpl['game-full'].render({
name: 'GTA IV',
platforms: [{
name: 'ps3'
}, {
name: 'xbox'
}
]
})模板/game/full.jade
h1 {{name}} is fine
ul
li I don't know how to list {{platforms}} here, one per li我想我只是被Jade>HTML>Hogan过程弄糊涂了,不确定要使用什么语法。
发布于 2013-09-14 06:29:54
呈现列表中的项的方法在这里进行了记录:https://gist.github.com/fat/1484342#file-gistfile1-html
可以在以下位置找到SocketStream应用程序中的示例:https://github.com/Anephenix/dashku/blob/master/client/templates/dashboard/nav.jade
看看你的代码,我建议你试试这个:
h1 {{name}} is fine
ul
{{#platforms}}
li I don't know how to list {{name}} here, one per li
{{/platforms}}https://stackoverflow.com/questions/17561520
复制相似问题