聚合物铁列表显示不正确

时间:2015-12-28 13:26:59

标签: polymer

<dom-module id="page-list">
<style include="shared-styles"></style>
<style>
 iron-list {
  height: 500px;      
}  
</style>
<template>
    <neon-animated-pages id="pages" selected="0">
        <neon-animatable><paper-button id="list-button" raised on-tap="_onOK" >List</paper-button></neon-animatable> 
        <neon-animatable>
          <iron-list id="list" items="[[data]]" as="item">
              <template>
                    <div>
                        Name: <span>[[item.name]]</span>
                    </div>
              </template>
          </iron-list>   
        </neon-animatable>
    </neon-animated-pages>                     
</template>
<script>
    Polymer({
        is: "page-list",
        attached: function () {
            this.data=[
                    {
                        index: 0,
                        name: "Liz Grimes"
                    },
                    {
                        index: 1,
                        name: "Frazier Lara"
                    },
                    {
                        index: 2,
                        name: "Dora Griffith"
                    }];
                    this.$.list.fire('resize');
        },
        behaviors: [
            Polymer.NeonAnimatableBehavior
        ],
        properties: {                
            data: {
                type: Array,
                notify: true
            }
        },
        _onOK: function (e) {
            this.$.pages.selected="1";
        }
    });
</script>

推送&#34; List&#34;按钮,铁列表预计将全部显示。不幸的是,结果是显示一行&#34;姓名:&#34;没有别的。如果我强制选择的页面为&#34; 1&#34;,<neon-animated-pages id="pages" selected="1">这意味着在浏览器的第一次刷新时,显示带有铁列表的页面,显示正确:三行与正确的数据。

这个问题似乎与启动时尚未显示带有铁列表的页面有关。

有人知道如何解决这个问题吗?

3 个答案:

答案 0 :(得分:1)

我认为你需要

t = 0:0.01:2
p = fom(t);

而不是

$fname = preg_replace("/[^ \w]+/", "", $fname);

让Polymer了解数据变化

答案 1 :(得分:1)

似乎是一个已知问题https://github.com/PolymerElements/neon-animation/issues/115

请在github上查看我建议的解决方案。

答案 2 :(得分:1)

以下解决方案仅仅是一个黑客攻击,但如果您在iron-resize上收听neon-animatable事件,然后在任何子notifyResize()元素上调用iron-list,那么您应该是能够解决这个问题,直到可以对https://github.com/PolymerElements/neon-animation/issues/115

进行更可持续的修复
相关问题