【修复】修复仿点餐模式下子列表数据上拉加载失败的问题。

This commit is contained in:
大灰灰
2022-11-21 21:59:22 +08:00
parent 53a367eb27
commit 7d239ebdac

View File

@@ -62,7 +62,7 @@
</view>
</view>
</scroll-view>
<scroll-view class="goods" scroll-with-animation scroll-y :scroll-top="headerH" :style="'height:' + scorllH+'px;'">
<scroll-view class="goods" scroll-with-animation scroll-y :scroll-top="headerH" :style="'height:' + scorllH+'px;'" @scrolltolower="scrolltolower">
<u-sticky v-if="menuChilds">
<view class="coreshop-bg-white coreshop-padding-left-10">
<u-tabs :list="menuChilds" :current="childCurrent" :activeStyle="{color: '#303133',fontWeight: 'bold',transform: 'scale(1.05)',fontSize:'14px'}" :inactiveStyle="{color: '#606266',transform: 'scale(1)',fontSize:'14px'}" @change="childIdCheck"></u-tabs>
@@ -93,7 +93,7 @@
</view>
</view>
</view>
<u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" margin-top="20" margin-bottom="20" />
<u-loadmore :status="loadStatus" :icon-type="iconType" :load-text="loadText" margin-top="20" margin-bottom="20" />
</view>
</view>
</scroll-view>
@@ -214,7 +214,6 @@
this.scorllH = e.windowHeight - e.statusBarHeight - 50;
}
})
// 获取购物车数量
if (this.$store.state.config.cateStyle == 4) {
this.goodsList = [];
@@ -232,11 +231,6 @@
this.getCartNums();
}
},
onReachBottom() {
if (this.loadStatus != 'nomore') {
this.getGoods();
}
},
methods: {
// 点击左边的栏目切换
async swichMenu(index) {
@@ -297,10 +291,12 @@
}
}
this.currentCateId = res.data[0].id;
this.needCurrentCateId = res.data[0].id;
this.menuChilds = res.data[0].child;
}
this.getGoods();
}
}
}
});
},
@@ -468,7 +464,12 @@
this.goodsList = [];
this.getGoods();
},
scrolltolower() {
console.log("触底了");
if (this.loadStatus != 'nomore') {
this.getGoods();
}
},
//取得商品数据
getGoods: function () {
uni.showLoading({
@@ -487,7 +488,7 @@
if (res.status) {
const _list = res.data.list;
_this.goodsList = [..._this.goodsList, ..._list];
if (res.data.totalCount > _this.goodsList.length) {
if (res.data.totalPages >= _this.page) {
_this.loadStatus = 'loadmore';
_this.page++;
} else {