[英]ion-content method scrollToPoint not working on Ionic 5
您不能在選擇器獲得的項目上應用方法。 你必須是 select 這個 ion-content 帶有@ViewChild
並且可以使用方法:
@ViewChild(IonContent) content: IonContent;
content.scrollToPoint(100,100);
如果有人在使用VueJS + Ionic 6時遇到問題。 我通過將 $ref 存儲在 mounted() 上的 data() 中使其工作。 不要忘記像這樣添加 ref 屬性: <ion-content ref="myContent">
。
data() {
return {
myCustomContent: null
};
}
在你的 mounted()
mounted() {
this.myCustomContent = this.$refs.myContent.$el;
}
你的方法:
scrollFunction() {
this.myCustomContent.scrollToBottom(500);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.