Commit db8ec649 by 李嘉林

商品列表添加滚动动画

parent 3a787cd4
...@@ -25,6 +25,7 @@ const componentOptions = { ...@@ -25,6 +25,7 @@ const componentOptions = {
classificationLoadNum: 10, classificationLoadNum: 10,
queryProductInfoLoading: false, queryProductInfoLoading: false,
loading: false, loading: false,
scrollLoading: false, // 滚动加载优化后添加加载动画
finished: false, finished: false,
goodsList:[], goodsList:[],
storageGoodsList:[], storageGoodsList:[],
...@@ -311,7 +312,8 @@ const componentOptions = { ...@@ -311,7 +312,8 @@ const componentOptions = {
this.setData({ this.setData({
"datas.componentData.goodsList": goodsList, "datas.componentData.goodsList": goodsList,
// goodsList // goodsList
loadingFlag loadingFlag,
scrollLoading: false,
},function () { },function () {
// that.lazyloading(); // that.lazyloading();
...@@ -377,7 +379,9 @@ const componentOptions = { ...@@ -377,7 +379,9 @@ const componentOptions = {
return return
} }
this.setData({
scrollLoading: true
})
wx.createSelectorQuery().selectAll(`.goodsListItemIndex${that.data.datasIndex}>>>.${type}`).boundingClientRect(function(rects){ wx.createSelectorQuery().selectAll(`.goodsListItemIndex${that.data.datasIndex}>>>.${type}`).boundingClientRect(function(rects){
for (let index = 0; index < rects.length; index++) { for (let index = 0; index < rects.length; index++) {
if (rects[index].top == 0 && rects[index].bottom == 0 && rects[index].left == 0 && rects[index].right == 0) { if (rects[index].top == 0 && rects[index].bottom == 0 && rects[index].left == 0 && rects[index].right == 0) {
...@@ -401,7 +405,7 @@ const componentOptions = { ...@@ -401,7 +405,7 @@ const componentOptions = {
if (that.data.pageGoodsList[that.data.datasIndex][that.data.pageGoodsList[that.data.datasIndex].length -1].loadState == true) { if (that.data.pageGoodsList[that.data.datasIndex][that.data.pageGoodsList[that.data.datasIndex].length -1].loadState == true) {
loadingFlag[that.data.datasIndex] = true loadingFlag[that.data.datasIndex] = true
that.setData({ that.setData({
loadingFlag loadingFlag,
}) })
wx.setStorageSync('loadingFlag',loadingFlag) wx.setStorageSync('loadingFlag',loadingFlag)
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
"usingComponents": { "usingComponents": {
"goods-item":"./GoodsItem/index", "goods-item":"./GoodsItem/index",
"waterfall-flow":"../module/WaterfallFlow/index", "waterfall-flow":"../module/WaterfallFlow/index",
"heap-item":"./heapItem/index" "heap-item":"./heapItem/index",
"van-loading":"/static/vant/loading/index"
} }
} }
...@@ -41,6 +41,10 @@ ...@@ -41,6 +41,10 @@
indexs="{{index}}" indexs="{{index}}"
></goods-item> ></goods-item>
</view> </view>
<!-- 网格布局滚动加载 -->
<view class="scrollLoading" wx:if="{{scrollLoading}}">
<van-loading size="16px" color="#fff"><text class="scrollLoadingText">加载中...</text></van-loading>
</view>
</view> </view>
<!-- 横向滚动 --> <!-- 横向滚动 -->
<view class="goods-across" wx:elif="{{datas.componentData.style==='across'}}"> <view class="goods-across" wx:elif="{{datas.componentData.style==='across'}}">
......
...@@ -91,3 +91,13 @@ image{ ...@@ -91,3 +91,13 @@ image{
display: inline-block; display: inline-block;
box-sizing: border-box; box-sizing: border-box;
} }
.scrollLoading{
width: 100%;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
}
.scrollLoading .scrollLoadingText{
color: #fff;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment