如何在 Ionic 2/3 中调整大小/重新绘制虚拟滚动?

How to resize / re-draw Virtual Scroll in Ionic 2/3?

我目前正在我的项目中使用 VirtualScroll。我实际上是在动态更新列表的字体,但它会扰乱大小,即虚拟滚动项目的高度。我目前想要 resize/redraw 字体大小更改后的虚拟滚动。我看到它有一些实例成员的文档,但我无法访问它。到目前为止,这是我引用它的方式:

@ViewChild("verseList") verseList: VirtualScroll;

this.verseList.resize(); //throws error

它也无法使用 nativeelement: ElementRef。我不确定调用这些实例成员:

 readUpdate()
 resize()
 scrollUpdate()
 setElementClass()
 writeUpdate()

刚刚弄明白了。就像我们使用 @ViewChild(Content) 访问 Content 一样,我们也可以使用 ViewChild:

访问它
@ViewChild(VirtualScroll) verseList: VirtualScroll;

确保从顶部的 ionic-angular 包导入 VirtualScroll