我使用scrollToPoint滚动到我的组件中的特定点,如下所示。
@ViewChild(IonContent) content: IonContent;
this.content.scrollToPoint(0, yOffset - 70, 1000);
但是它给出了一个错误,比如
错误:未捕获(在promise中):TypeError:无法读取null的属性'scrollTop‘TypeError:无法读取null的属性'scrollTop’
有人能在这方面给我一些建议吗?
发布于 2019-04-16 06:58:30
因为dom还没有准备好。这只是个平台。使用ionViewDidEnter事件处理程序。
ionViewDidEnter() {
let yOffset = document.getElementById('alp');
this.content.scrollToPoint(0, yOffset - 70, 1000);
}
发布于 2019-03-25 23:33:31
我不确定,但它的内容,而不是viewChild中的IonContent
https://stackoverflow.com/questions/55340032
复制相似问题