Polymer 将路径附加到图标-谷歌聚合物

Polymer 将路径附加到图标-谷歌聚合物,polymer,polymer-1.0,Polymer,Polymer 1.0,在我的项目中,我绑定了一个JSON数组中的“paper fab”元素列表。 我只想给出图标的名称,而不是使用'paper fab'的'src'属性绑定的完整路径。我怎样才能做到这一点?是否可以使用计算属性进行此操作?提前谢谢 下面给出了代码片段和JSON格式 <ul id="actionButtons"> <template is="dom-repeat" items="[[plugins]]"> <li> &l

在我的项目中,我绑定了一个JSON数组中的“paper fab”元素列表。 我只想给出图标的名称,而不是使用'paper fab'的'src'属性绑定的完整路径。我怎样才能做到这一点?是否可以使用计算属性进行此操作?提前谢谢

下面给出了代码片段和JSON格式

<ul id="actionButtons">
    <template is="dom-repeat" items="[[plugins]]">
        <li>
            <span>
                <paper-fab mini src="[[item.iconSrc]]" id="[[item.id]]" name="[[item.name]]" class$="[[item.cssClass]]"> </paper-fab>
            </span>
        </li>
    </template> </ul>
退房


我的名字是{{computeFullName(first,last)}
聚合物({
是:“x-custom”,
特性:{
第一:字符串,
最后:字符串
},
computeFullName:函数(第一个,最后一个){
返回第一个+“”+最后一个;
}
...
});
您应该能够将
item.iconrc
传递给您的计算机,以便将路径附加到图标签出


我的名字是{{computeFullName(first,last)}
聚合物({
是:“x-custom”,
特性:{
第一:字符串,
最后:字符串
},
computeFullName:函数(第一个,最后一个){
返回第一个+“”+最后一个;
}
...
});

您应该能够将
item.iconrc
传递给您的计算机,以便将路径附加到图标上

谢谢您的帮助。成功了!。我之前选中了“计算绑定”选项,但我不知道如何传递参数。谢谢您的帮助。成功了!。我之前选中了“Computed Binding”选项,但我不知道如何传递参数。
plugins:
[
        {
            "id": 1,
            "name": "Image_1",
            "iconSrc": "app/images/icons/pacs_pull.png",
            "cssClass": "white"
        },
        {
            "id": 2,
            "name": "Image_2",
            "iconSrc": "app/images/icons/pacs_push.png",
            "cssClass": "grey"
        },
        {
            "id": 3,
            "name": "Image_3",
            "iconSrc": "app/images/icons/fileBrowser.png",
            "cssClass": "white",
        }
]
  <template>
    My name is <span>{{computeFullName(first, last)}}</span>
  </template>

  <script>
    Polymer({
      is: 'x-custom',
      properties: {
        first: String,
        last: String       
      },
      computeFullName: function(first, last) {
        return first + ' ' + last;
      }
      ...
    });
  </script>

</dom-module>