【发布时间】:2017-05-18 20:10:59
【问题描述】:
我使用把手#each 循环通过具有给定布尔属性的对象,例如:
elements: [
{
text: "a"
active: true
},
{
text: "b"
active: false
}
]
根据该属性将类添加到 html 元素的最简单方法是什么?像这样的:
{{#each elements}}
<article class={{if active 'active-class'}}>
...
{{/each}}
我正在使用车把 4.0.6
【问题讨论】:
标签: handlebars.js