<ion-content scrollEvents="true" (ionScroll)="onScroll($event)">
scrollEvents="true"必须加,否则不生效。
topTimer = null;
onScroll(event){
this.topTimer && clearTimeout(this.topTimer);
this.topTimer = setTimeout(function(){
event.detail.scrollTop>500 ?this.top = true:this.top = false;
}.bind(this),500)
}
this.top表示回到顶部的按钮是否出现