Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 couchapp 上的 mustache.html 上写了这个
**{{%IMPLICIT-ITERATOR iterator=i}} {{#example}}
你好 {{i}}
{{/例子}}**
用这个数组
{“示例”:[“阿尔法”,“贝塔”,“伽马”,“德尔塔”] }
但是 couchapp 的结果是这样的
你好阿尔法,贝塔,伽马,三角洲
我怎样才能得到哈洛贝塔和哈洛三角洲?
谢谢
这是一个领域,如果你不习惯“无逻辑”的模板,你会觉得你有一些手铐。简而言之,如果您只想在 mustache 中渲染数组的子集,那么您需要提供一个包含您想要显示的元素的数组。
AFAIK,没有办法放置“如果元素是'a'打印它,否则不打印它”形式的条件逻辑。当然,mustache 提供了一些基于数据是否存在的条件执行(例如 {{^ foo}} 语句)。更精细的调整/复杂的显示逻辑是不可能的。