Commit e9f2e85e by xiexiaoqin

fix: 下拉数据过长时点击回到今天不重置数据

parent 34fc0056
......@@ -572,7 +572,9 @@ create.Page({
const offset = this.getScrollOffset(e.detail.scrollTop);
dd.createSelectorQuery().selectAll('.li').boundingClientRect().exec((rect) => {
//日程的上下箭头
this.setScrollOffset(rect);
if (rect[0]) {
this.setScrollOffset(rect);
}
if (offset == 'next') {
for (let i = this.data.currentDataIndex; i < rect[0].length; i++) {
if (rect[0][i].top > 0) {
......@@ -658,11 +660,9 @@ create.Page({
}, 1000),
backToToday(type) {
if (!type) {
//如果当前的日期还没加载出来点击无效,下拉积累数据过长可以去掉
const isFindArr = this.data.scheduleList.filter(
it => it.dateStr == toLocaleDateString(currentDate)
);
if (isFindArr.length == 0 || this.data.scheduleList.length > 100) {
//如果当前的日期还没加载出来点击无效
const isFindArr = this.data.scheduleList.filter(it => it.dateStr == toLocaleDateString(currentDate));
if (isFindArr.length == 0) {
//去掉头部空数据
if (this.minYear < minYear) {
this.scheduleList.splice(0, this.blankDataLength);
......@@ -675,10 +675,7 @@ create.Page({
}
this.getPagination(this.scheduleList);
this.setData({
scheduleList: this.scheduleList.slice(
this.firstPage * this.pageSize,
this.currentPage * this.pageSize
)
scheduleList: this.scheduleList.slice(this.firstPage * this.pageSize, this.currentPage * this.pageSize)
});
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment