fix: 修复图库瀑布流模式无数据下,切换其他分类有数据不显示数据bug

This commit is contained in:
小莫唐尼 2024-08-18 20:41:03 +08:00
parent da60eb2daf
commit 706cee2240

View File

@ -111,13 +111,13 @@ export default {
this.dataList = [] this.dataList = []
this.isLoadMore = false; this.isLoadMore = false;
this.queryParams.page = 1; this.queryParams.page = 1;
this.fnGetData(); this.fnGetData(true);
}, },
onReachBottom(e) { onReachBottom(e) {
if (this.hasNext) { if (this.hasNext) {
this.queryParams.page += 1; this.queryParams.page += 1;
this.isLoadMore = true; this.isLoadMore = true;
this.fnGetData(); this.fnGetData(false);
} else { } else {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
@ -131,16 +131,8 @@ export default {
this.queryParams.group = this.category.list[index].name; this.queryParams.group = this.category.list[index].name;
this.queryParams.page = 1; this.queryParams.page = 1;
this.fnToTopPage(); this.fnToTopPage();
if (this.galleryConfig.useWaterfall) {
this.$nextTick(() => {
this.$refs.wafll.clear();
this.dataList = []; this.dataList = [];
this.fnGetData(); this.fnGetData(true);
})
} else {
this.dataList = [];
this.fnGetData();
}
}, },
fnGetCategory() { fnGetCategory() {
this.$httpApi.v2.getPhotoGroupList({ this.$httpApi.v2.getPhotoGroupList({
@ -155,11 +147,11 @@ export default {
}); });
if (this.category.list.length !== 0) { if (this.category.list.length !== 0) {
this.queryParams.group = this.category.list[0].name; this.queryParams.group = this.category.list[0].name;
this.fnGetData(); this.fnGetData(true);
} }
}); });
}, },
fnGetData() { fnGetData(isClearWallfull = false) {
// //
if (!this.isLoadMore) { if (!this.isLoadMore) {
this.loading = 'loading'; this.loading = 'loading';
@ -182,6 +174,9 @@ export default {
} }
if (this.galleryConfig.useWaterfall) { if (this.galleryConfig.useWaterfall) {
this.$nextTick(() => { this.$nextTick(() => {
if(isClearWallfull){
this.$refs.wafll.clear()
}
this.$refs.wafll.pushData(_list) this.$refs.wafll.pushData(_list)
}) })
} }