loadmore 7.27

This commit is contained in:
2020-07-27 17:59:47 +08:00
parent 100f31c6f9
commit 6eabd3a575
17 changed files with 421 additions and 58 deletions

View File

@@ -7,7 +7,7 @@
<swiper-item class="swiper-item" v-for="(_, index) in tabList" :key="index">
<scroll-view scroll-y style="height: 800rpx;width: 100%;" @scrolltolower="onreachBottom">
<SpecialGoods v-for="(item, index) in pinTuanList" :key="index" :item="item" type='group'></SpecialGoods>
<!-- <loadmore ref="loadmore" @callback="getPinTuanList" bgColor="#FFF"></loadmore> -->
<loadmore ref="loadmore" @callback="getPinTuanList" bgColor="#FFF"></loadmore>
<u-empty text="暂无商品" mode="list" color="#000" v-if="!pinTuanList.length"></u-empty>
</scroll-view>
</swiper-item>
@@ -39,8 +39,7 @@ export default {
},
watch: {
current(index) {
// console.log(this.tabList);
this.getPinTuanList({id: this.tabList[index].gc_id });
this.getPinTuanList({ id: this.tabList[index].gc_id });
}
},
methods: {
@@ -81,20 +80,20 @@ export default {
// scroll-view到底部加载更多
onreachBottom() {
this.$$refs.loadmore.reachBottom();
// if(!this.timer) return false;
// this.loadStatus = "loading";
// this.page++;
// this.getPinTuanList().then(length => {
// if(length == 0) {
// this.page--;
// this.status = 'nomore';
// } else {
// this.status = 'loading';
// }
// }).catch(() => {
// this.loadStatus = "nomore";
// this.page--;
// })
if(!this.timer) return false;
this.loadStatus = "loading";
this.page++;
this.getPinTuanList().then(length => {
if(length == 0) {
this.page--;
this.status = 'nomore';
} else {
this.status = 'loading';
}
}).catch(() => {
this.loadStatus = "nomore";
this.page--;
})
},
setViewHeight() {
const res = uni.getSystemInfoSync();