如此处所述:http: //jade-lang.com/reference/,获取索引或密钥很容易。但是有没有办法两者兼得?
这个:
ul
each val, index in {"day": "Wed", "link": "url", "message": "three"}
li#item-= index + ': ' + val
输出这个:
<ul>
<li id="item-">day: Wed</li>
<li id="item-">link: url</li>
<li id="item-">message: three</li>
</ul>
但我想要这个:
<ul>
<li id="item-0">day: Wed</li>
<li id="item-1">link: url</li>
<li id="item-2">message: three</li>
</ul>