fix(article list): 修复空数据处理和加载时机调整

1. 给列表数据新增空值兜底避免报错
2. 调整loading隐藏和分页结束的执行顺序
This commit is contained in:
2026-06-29 10:32:00 +08:00
parent 7e4400267e
commit 3cedbd7b6b

View File

@@ -22,9 +22,9 @@
</view> </view>
</view> </view>
<view v-else class="empty-wrap"><ns-empty :text="$lang('emptyText')" :isIndex="false"></ns-empty></view> <view v-else class="empty-wrap"><ns-empty :text="$lang('emptyText')" :isIndex="false"></ns-empty></view>
<loading-cover ref="loadingCover"></loading-cover>
</block> </block>
</mescroll-uni> </mescroll-uni>
<loading-cover ref="loadingCover"></loading-cover>
<!-- 隐私弹窗 --> <!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup> <privacy-popup ref="privacyPopup"></privacy-popup>
@@ -58,16 +58,16 @@ export default {
let newArr = []; let newArr = [];
let msg = res.message; let msg = res.message;
if (res.code == 0 && res.data) { if (res.code == 0 && res.data) {
newArr = res.data.list; newArr = res.data.list || [];
} else { } else {
this.$util.showToast({ this.$util.showToast({
title: msg title: msg
}); });
} }
mescroll.endSuccess(newArr.length);
//设置列表数据 //设置列表数据
if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表 if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
this.list = this.list.concat(newArr); //追加新数据 this.list = this.list.concat(newArr); //追加新数据
mescroll.endSuccess(newArr.length);
if (this.$refs.loadingCover) this.$refs.loadingCover.hide(); if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}, },
fail: res => { fail: res => {