Skip to content

Commit 5082248

Browse files
committed
update: display loading status when the home page gets list data
1 parent 708c211 commit 5082248

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/pages/index/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Page({
22
data: {
33
bIsReady: false, // 页面是否准备就绪
4+
bIsFetchingTopicList: false, // 是否正在获取专题列表数据
45
nActiveTabIndex: 0, // 当前处于活动状态的tab
56
nContentLen: 60, // 主题卡片显示正文的长度
67
aTabBarList: [
@@ -90,6 +91,9 @@ Page({
9091
* 0 => 正常获取 1 => 页面触底后获取 2 => 切换tab后获取
9192
*/
9293
fnNetRTopicList(nFetchScene = 0) {
94+
this.setData({
95+
bIsFetchingTopicList: true
96+
});
9397
// 显示标题栏加载效果
9498
wx.showNavigationBarLoading();
9599
wx.dc.topic
@@ -114,15 +118,17 @@ Page({
114118
wx.stopPullDownRefresh();
115119
wx.hideNavigationBarLoading();
116120
this.setData({
117-
bIsReady: true
121+
bIsReady: true,
122+
bIsFetchingTopicList: false
118123
});
119124
})
120125
.catch(() => {
121126
// 停止加载效果
122127
wx.stopPullDownRefresh();
123128
wx.hideNavigationBarLoading();
124129
this.setData({
125-
bIsReady: true
130+
bIsReady: true,
131+
bIsFetchingTopicList: false
126132
});
127133
});
128134
},

src/pages/index/index.wxml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<view class="topic-list-wrap">
1616
<block wx:if="{{aTopicList.length}}">
1717
<topic-list data="{{aTopicList}}"></topic-list>
18+
<view class="topic-list-loading ta-c color-grey">加载中...</view>
1819
</block>
1920
<block wx:else>
2021
<view class="topic-list-no-data vh-parent color-grey">

src/pages/index/index.wxss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
.topic-list-wrap {
2828
padding: 20rpx
2929
}
30+
.topic-list-loading {
31+
padding: 10rpx;
32+
font-size: 28rpx;
33+
}
3034
.topic-list-no-data {
3135
height: calc(100vh - 150rpx);
3236
font-size: 28rpx;

0 commit comments

Comments
 (0)