polymer 铁列表显示不正确

标签 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>

按下“列表”按钮后,预计将完整显示熨斗列表。不幸的是,结果只显示一行“Name:”,没有其他内容。如果我将所选页面强制设置为“1”,<neon-animated-pages id="pages" selected="1">这意味着在浏览器第一次刷新时,会显示带有铁列表的页面,显示是正确的:三行数据正确。

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

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

最佳答案

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

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

关于 polymer 铁列表显示不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34494427/

相关文章:

javascript - 为什么这个 polymer 元素的属性解析为未定义?

node.js - 在没有 Node 或 NPM 的情况下安装和运行 Polymer 需要什么?

polymer - 在 Polymer 3 中导入 Polymer 2 组件

javascript - window.scrollTo 页面加载不可靠

arrays - 清除 Polymer 中的数组?

javascript - Polymer dom-repeat 中的 SVG <use> 标签

django - 在 Django 模板中导入 Web 组件的推荐方法?

coffeescript - 如何正确使用coffeescript/sass(编译语言)和Google Polymer?

javascript - Polymer dom-repeat 并显示iron-ajax 调用的结果

javascript - 无法访问嵌套模板/重复模板中的元素?