Commit 79443252 by liang ce

修改scroll定位

parent b7fb19ed
......@@ -2,7 +2,7 @@
<view>2020年3月</view>
<view onTap="changesidebar">icon</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="{{scheduleYearList}}">
<block a:if="{{item.type == 'year'}}">
......
......@@ -59,18 +59,24 @@ create.Component({
scheduleList.push(that.returnScheduleList(2019 + i));
}
// 第一次加载
const today = new Date();
// finalDate 是用来定位到今天的
const finalDate = new Date(today);
const finalDate = new Date();
// finalDate.setDate(today.getDate() - today.getDay())
that.setData({
scheduleList: scheduleList,
todayStr: finalDate.toLocaleDateString(),
thisYear: year,
maxYear: year,
startPageOnShow: true,
isFirstLoad: false
});
that.setData(
{
scheduleList: scheduleList,
thisYear: year,
maxYear: year,
startPageOnShow: true,
isFirstLoad: false
},
() => {
that.setData({
todayStr: finalDate.toLocaleDateString()
});
}
);
}
);
});
......
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