简体   繁体   English

结合` <iron-list> 与` <paper-scroll-header-panel> `

[英]Combining an `<iron-list>` with a `<paper-scroll-header-panel>`

The <iron-list> ( docs ) requires a fixed height, yet on the other hand <paper-scroll-header-panel> ( docs , demo ) expects the <div> to have more height than is available, thus allowing you to collapse the header whilst scrolling. <iron-list>docs )需要固定的高度,但是另一方面, <paper-scroll-header-panel>docsdemo )期望<div>高度大于可用高度,因此允许您在滚动时折叠标题。 How can one combine these two elements in such a way that the iron list recalculates properly (manually resize it and trigger the resize event? :S ) whilst the header becomes smaller? 如何以一种这样的方式组合这两个元素,使得铁头列表正确地重新计算(手动调整其大小并触发resize事件?:S),而标题变小?

Consider this layout below. 考虑下面的这种布局。 As long as the iron-list 's parent - paper-scroll-header-panel has a fit selector, it should just work without doing anything extra. 只要iron-list的父项paper-scroll-header-panel具有fit选择器,它就可以正常工作而无需执行任何其他操作。

<paper-scroll-header-panel class="fit" condenses keep-condensed-header>
  <paper-toolbar class="tall">
  </paper-toolbar>
  <iron-list items="[[data]]">

This is because - 这是因为 -

iron-list must ether be explicitly sized, or delegate scrolling to an explicitly sized parent. iron-list必须以太大小显式,或者委托滚动到显式大小的父级。 By "explicitly sized", we mean it either has an explicit CSS height property set via a class or inline style, or else is sized by other layout means (eg the flex or fit classes). “显式调整大小”是指它要么通过类或内联样式设置了显式的CSS height属性,要么通过其他布局方式(例如flex或fit类)进行调整。

You can read this from the official document and also check out this live demo with these two working together. 您可以从官方文档中阅读此内容 ,也可以通过这两个一起查看此实时演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM