Skip to content

Commit

Permalink
v0.3.1-scrollToTop、scrollToBottom、scrollToY添加是否展示滚动动画
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileZXLee committed Nov 25, 2024
1 parent e37c660 commit e4fb373
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ by ZXLee
this.totalData = [];
}
if (this.scrollToTopWhenReload) {
this.scrollToTop();
this.scrollToTop(false);
}
this._emitQuery(this.pageNo, this.defaultPageSize);
},
Expand Down Expand Up @@ -448,16 +448,17 @@ by ZXLee
this.isLoading = false;
},
// 滚动到顶部
scrollToTop() {
this.scrollToY(0);
scrollToTop(animate: boolean) {
this.scrollToY(0, animate);
this._checkShouldShowBackToTop(0);
},
// 滚动到底部
scrollToBottom() {
this.scrollToY(99999999);
scrollToBottom(animate: boolean) {
this.scrollToY(99999999, animate);
},
// 滚动到指定位置,y为与顶部的距离,单位为px
scrollToY(y: number) {
scrollToY(y: number, animate: boolean) {
this.privateScrollWithAnimation = animate ? 1 : 0;
this.scrollTop = this.oldScrollTop;
this.$nextTick(() => {
this.scrollTop = y;
Expand Down Expand Up @@ -553,7 +554,7 @@ by ZXLee
},
//处理滚动到顶部
_handleToTop() {
this.scrollToTop();
this.scrollToTop(true);
},
}
}
Expand Down

0 comments on commit e4fb373

Please sign in to comment.