聚合物 - 在模板中迭代对象 [英] Polymer - Iterating over object in template
问题描述
根据聚合物文档,可以迭代对象或数组在< template>
中使用重复
语句:
According to the polymer docs, an object or array can be iterated over using the repeat
statement in a <template>
:
expression可以是简单的标识符,路径或完整表达式(包括Object和Array文字)。
"expression" can be a simple identifier, a path or a full expression (including Object and Array literals).
然而,在测试之后,似乎repeat语句只适用于数组,而不适用于对象:
After testing, however, it seems as though the repeat statement only works with arrays, and not with objects:
http://jsbin.com/oqotUdE/4/edit
我做错了什么?
推荐答案
那里的文档是不精确的。表达式的一般性质是明确的,但我不认为它打算说你可以迭代重复对象。
The docs there are imprecise. The general nature of expressions is explicated but I don't believe it intends to say you can iterate over objects with repeat.
我相信只有Arrays支持迭代时间,虽然有人说可能支持NodeLists。
I believe only Arrays are support for iteration at this time, although there is talk of possibly supporting NodeLists also.
这篇关于聚合物 - 在模板中迭代对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!