Polymer 聚合物通过核心元素结合价值

Polymer 聚合物通过核心元素结合价值,polymer,Polymer,我在传递核心列表包装的标记内的category变量时遇到问题 我试过了,但没有成功。{{category}}正确出现在第二个模板标记之外 <polymer-element name="library-list" attributes="category"> <template> <style> ... </style> <service-library id="library" items="{{items}

我在传递核心列表包装的标记内的category变量时遇到问题

我试过了,但没有成功。{{category}}正确出现在第二个模板标记之外

<polymer-element name="library-list" attributes="category">
<template>
    <style>
    ...
    </style>

    <service-library id="library" items="{{items}}"></service-library>

    <core-list id="list" data="{{items}}" on-core-select="{{onClick}}">
        <template>
            <div class="item {{ {selected: selected} | tokenList }}" hidden?="{{category == type}}">
                <div class="message">
                    <span class="title">{{title}}</span>
                </div>
            </div>
        </template>
    </core-list>
</template>

也许你想试试注射法

 <core-list data="{{data}}">
    <template>
      <div class="item {{ {selected: selected} | tokenList }}">
          <span>{{foo}}-<b>{{category}}</b></span>
      </div>
    </template>
  </core-list>
...
data.push({
    foo: 999,
    category:this.category,
    ...});

jsbin demo

我找不到一个好的解决方案,所以我过滤了核心列表显示的数据。

{{data}}已经被一个ajax请求占用了,我需要传递除此之外的数据。我的两分钱。将类别注入数据对象的隐藏元素。