Commit 79443252 by liang ce

修改scroll定位

parent b7fb19ed
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view>2020年3月</view> <view>2020年3月</view>
<view onTap="changesidebar">icon</view> <view onTap="changesidebar">icon</view>
</view> </view>
<scroll-view class="indexScrollView" scroll-y="{{true}}" style="background: #FFFFFF" lower-threshold="1000" onScrollToLower="lower" scroll-into-view="{{thisDay}}"> <scroll-view class="indexScrollView" scroll-y="{{true}}" style="background: #FFFFFF" lower-threshold="1000" onScrollToLower="lower" scroll-into-view="{{todayStr}}">
<block a:for="{{scheduleList}}" a:for-item="scheduleYearList"> <block a:for="{{scheduleList}}" a:for-item="scheduleYearList">
<block a:for="{{scheduleYearList}}"> <block a:for="{{scheduleYearList}}">
<block a:if="{{item.type == 'year'}}"> <block a:if="{{item.type == 'year'}}">
......
...@@ -59,20 +59,26 @@ create.Component({ ...@@ -59,20 +59,26 @@ create.Component({
scheduleList.push(that.returnScheduleList(2019 + i)); scheduleList.push(that.returnScheduleList(2019 + i));
} }
// 第一次加载 // 第一次加载
const today = new Date();
// finalDate 是用来定位到今天的 // finalDate 是用来定位到今天的
const finalDate = new Date(today); const finalDate = new Date();
// finalDate.setDate(today.getDate() - today.getDay()) // finalDate.setDate(today.getDate() - today.getDay())
that.setData({ that.setData(
{
scheduleList: scheduleList, scheduleList: scheduleList,
todayStr: finalDate.toLocaleDateString(),
thisYear: year, thisYear: year,
maxYear: year, maxYear: year,
startPageOnShow: true, startPageOnShow: true,
isFirstLoad: false isFirstLoad: false
},
() => {
that.setData({
todayStr: finalDate.toLocaleDateString()
}); });
} }
); );
}
);
}); });
}, 1000), }, 1000),
nextDetail: throttle(function(e) { nextDetail: throttle(function(e) {
......
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