{{ }} //不解析html标签而是直接显示出来 {{{ }}} //解析html标签 {{#if author}} //定义了author属性就输出以下

{{firstName}} {{lastName}}

{{/if}} {{#if author}}

{{firstName}} {{lastName}}

{{else}}

Unknown Author

{{/if}} {{#unless license}} //#unless 和 if 相反 ,条件为假时才执行

WARNING: This entry does not have a license!

{{/unless}} {{author.name}} {{author.id}} author:{ name: "Yehuda Katz",id:187} {{#each people}}
  • {{this}}
  • {{/each}} people:{ a:['a1','a2'],b:['b1','b2'] }
  • a1,a2
  • b1,b2
  • {{#each people}}
  • {{this}}
  • {{/each}} people:[ ['a1','a2'],['b1','b2'] ]
  • a1,a2
  • b1,b2
  • {{#each paragraphs}} //有定义paragraphs就遍历

    {{this}}

    {{else}} 没有就输出以下

    No content

    {{/each}} paragraphs:[ ['a1','a2'],['b1','b2'] ], 为遍历添加索引 {{#each array}} {{@index}}: {{this}} {{/each}} 为遍历获取键值对 {{#each object}} {{@key}}: {{this}} {{/each}}