显示没有计算功能的项目内容

时间:2015-07-15 09:28:45

标签: html polymer web-component polymer-1.0

在聚合物1.0自定义元素中,我想迭代一个数组,显示其内容的项目。 我得到的只是[object Object]标签,没有显示其内容。

是否可以实现没有计算函数 - like in this solution - 迭代每个item属性并将其作为字符串返回?

我的列表迭代看起来像:

<h4>My items:</h4>
<ol>
    <template is="dom-repeat" items="{{items}}">
      <li>{{item}}</li>
    </template>
</ol>

我做了a plunker,你可以在那里重现它。

我看到open issue引用了此功能。

1 个答案:

答案 0 :(得分:0)

您可以按

显示ID
<li>{{item.id}}</li>

check the plunker

但这不是要求。我认为马里奥要求整个对象以字符串形式出现。