📜  Mustache - 如何检测数组不为空? - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:20.198000             🧑  作者: Mango

代码示例1
Using {{#users.length}} works great if you want the inner statement to repeat for every element of the array, but if you only want a statement to only run once, you can use:

{{#users.0}}
...
{{/users.0}}
{{^users.0}}
...
{{/users.0}}