mustache.js 是否支持这样的表达方式?-> {{type == "a"}}
我该怎么办?
小胡子:</p>
{{#items}}
{{type == "a"}}
<li>{{name}} {{type}}</li>
{{/link}}
{{type == "b"}}
<strong>{{name}} {{type}}</strong>
{{type == "c"}}
<span>{{name}} {{type}}</span>
{{/link}}
{{/items}}
JSON:</p>
{
"header": "Colors",
"items": [
{"name": "red", "type": "a", "url": "#Red"},
{"name": "green", "type": "b", "url": "#Green"},
{"name": "blue", "type": "c", "url": "#Blue"}
],
"empty": false
}
想要输出:
<li>red a</li>
<strong>green b</strong>
<span>blue c</span>