<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/