Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
f3e0b049
Commit
f3e0b049
authored
Sep 19, 2022
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
列表布局滚动加载
parent
79d65692
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
7 deletions
+54
-7
static/nativeComponents/GoodsList/index.js
+40
-6
static/nativeComponents/GoodsList/index.wxml
+6
-0
static/nativeComponents/GoodsList/index.wxss
+7
-0
static/nativeComponents/module/WaterfallFlow/index.wxml
+1
-1
No files found.
static/nativeComponents/GoodsList/index.js
View file @
f3e0b049
...
@@ -66,6 +66,7 @@ const componentOptions = {
...
@@ -66,6 +66,7 @@ const componentOptions = {
},
},
randomNumber
:
""
,
randomNumber
:
""
,
selectScreen
:
false
,
// 筛选选中状态
selectScreen
:
false
,
// 筛选选中状态
clientHeight
:
0
,
//窗口高度
},
},
// 数据监听器
// 数据监听器
observers
:
{},
observers
:
{},
...
@@ -74,6 +75,13 @@ const componentOptions = {
...
@@ -74,6 +75,13 @@ const componentOptions = {
created
()
{},
created
()
{},
ready
()
{
ready
()
{
let
_this
=
this
;
let
_this
=
this
;
let
{
clientHeight
}
=
this
.
data
;
wx
.
getSystemInfo
({
success
:
function
(
res
)
{
let
clientHeight
=
parseInt
(
res
.
windowHeight
);
_this
.
setData
({
clientHeight
});
}
});
app
.
getFilterGoodsData
=
(
val
)
=>
{
app
.
getFilterGoodsData
=
(
val
)
=>
{
if
(
val
.
randomNumber
!=
_this
.
data
.
randomNumber
)
return
;
if
(
val
.
randomNumber
!=
_this
.
data
.
randomNumber
)
return
;
console
.
log
(
val
,
'-------------------------77'
)
console
.
log
(
val
,
'-------------------------77'
)
...
@@ -539,7 +547,7 @@ const componentOptions = {
...
@@ -539,7 +547,7 @@ const componentOptions = {
}
}
// 瀑布流模式默认查6条
// 瀑布流模式默认查6条
if
(
this
.
data
.
datas
.
componentData
.
style
==
"waterfall"
&&
this
.
data
.
datas
.
componentData
[
"goodsSource"
]
==
"specifyFilter"
){
if
(
this
.
data
.
datas
.
componentData
.
style
==
"waterfall"
&&
this
.
data
.
datas
.
componentData
[
"goodsSource"
]
==
"specifyFilter"
){
return
6
;
return
10
;
}
}
//数量
//数量
if
(
if
(
...
@@ -549,7 +557,7 @@ const componentOptions = {
...
@@ -549,7 +557,7 @@ const componentOptions = {
//网格模式
//网格模式
if
(
if
(
this
.
data
.
datas
.
componentData
.
rowNum
*
this
.
data
.
datas
.
componentData
.
rowNum
*
this
.
data
.
datas
.
componentData
.
columnNum
>=
this
.
data
.
datas
.
componentData
.
columnNum
>=
this
.
data
.
datas
.
componentData
.
goodsList
.
length
this
.
data
.
datas
.
componentData
.
goodsList
.
length
)
{
)
{
return
this
.
data
.
datas
.
componentData
.
goodsList
.
length
;
return
this
.
data
.
datas
.
componentData
.
goodsList
.
length
;
...
@@ -560,7 +568,7 @@ const componentOptions = {
...
@@ -560,7 +568,7 @@ const componentOptions = {
);
);
}
}
}
else
{
}
else
{
return
this
.
data
.
datas
.
componentData
.
goodsList
.
length
;
return
10
;
}
}
},
},
showRowNum
()
{
showRowNum
()
{
...
@@ -612,12 +620,38 @@ const componentOptions = {
...
@@ -612,12 +620,38 @@ const componentOptions = {
this
.
lazyloading
()
this
.
lazyloading
()
if
(
if
(
(
goodsSource
==
"classify"
||
goodsSource
==
"specifyFilter"
)
&&
(
goodsSource
==
"classify"
||
goodsSource
==
"specifyFilter"
)
&&
moreShow
==
false
&&
moreShow
==
false
style
==
"waterfall"
)
{
)
{
this
.
selectComponent
(
"#waterfallFlow"
).
getScroll
(
el
);
if
(
style
==
"waterfall"
)
{
this
.
selectComponent
(
"#waterfallFlow"
).
getScroll
(
el
);
}
else
if
(
style
==
"rowList"
)
{
console
.
log
(
"rowList--滚动加载"
)
this
.
getScrollEl
(
el
);
}
}
}
},
},
getScrollEl
(
el
)
{
let
{
finished
}
=
this
.
data
;
let
_this
=
this
;
_this
.
createSelectorQuery
()
.
select
(
"#goods-rowList"
)
.
boundingClientRect
(
function
(
res
)
{
if
(
res
)
{
let
scrollTop
=
parseInt
(
el
.
scrollTop
);
let
domHeight
=
parseInt
(
res
.
height
);
// 窗口高度+滚动高度等于 = 元素整体高度 -(预留一段距离加载) 触发父组件查询接口
console
.
log
(
scrollTop
,
_this
.
data
.
clientHeight
,
domHeight
-
150
,
domHeight
,
finished
,
'--------------finished1'
)
if
(
scrollTop
+
_this
.
data
.
clientHeight
>=
domHeight
-
150
&&
finished
==
false
)
{
_this
.
onLoad
();
}
}
})
.
exec
();
},
// 分页加载
// 分页加载
onLoad
()
{
onLoad
()
{
console
.
log
(
"---触发分页加载"
);
console
.
log
(
"---触发分页加载"
);
...
...
static/nativeComponents/GoodsList/index.wxml
View file @
f3e0b049
...
@@ -123,6 +123,7 @@
...
@@ -123,6 +123,7 @@
<!-- 横向列表 -->
<!-- 横向列表 -->
<view
<view
class="goods goods-rowList"
class="goods goods-rowList"
id="goods-rowList"
wx:elif="{{datas.componentData.style==='rowList'}}"
wx:elif="{{datas.componentData.style==='rowList'}}"
style="margin-left:{{-datas.componentData.proGap*2}}rpx;"
style="margin-left:{{-datas.componentData.proGap*2}}rpx;"
>
>
...
@@ -138,6 +139,11 @@
...
@@ -138,6 +139,11 @@
indexs="{{index}}"
indexs="{{index}}"
></goods-item>
></goods-item>
</view>
</view>
<!-- 上拉加载底部展示 -->
<view class="loadBottom" wx:if="{{datas.componentData.moreShow == false && datas.componentData.style == 'rowList'}}">
<text wx:if="{{loading}}">加载中...</text>
<text wx:if="{{ finished}}">暂无更多</text>
</view>
</view>
</view>
<!-- 堆叠卡片 -->
<!-- 堆叠卡片 -->
<view class="goods-heap-Item" wx:if="{{datas.componentData.style==='heap'}}">
<view class="goods-heap-Item" wx:if="{{datas.componentData.style==='heap'}}">
...
...
static/nativeComponents/GoodsList/index.wxss
View file @
f3e0b049
...
@@ -201,4 +201,10 @@ image{
...
@@ -201,4 +201,10 @@ image{
}
}
.scrollLoading .scrollLoadingText{
.scrollLoading .scrollLoadingText{
color: #fff;
color: #fff;
}
.loadBottom{
text-align: center;
color: #999;
font-size: 24rpx;
margin-top: 10rpx;
}
}
\ No newline at end of file
static/nativeComponents/module/WaterfallFlow/index.wxml
View file @
f3e0b049
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
</view>
</view>
<!-- 上拉加载底部展示 -->
<!-- 上拉加载底部展示 -->
<view class="loadBottom" wx:if="{{datas.componentData.goodsSource == 'classify' && datas.componentData.moreShow == false &&datas.componentData.style == 'waterfall'}}">
<view class="loadBottom" wx:if="{{datas.componentData.goodsSource == 'classify' && datas.componentData.moreShow == false &&datas.componentData.style == 'waterfall'}}">
<text wx:if="{{loading}}">加载中
~
</text>
<text wx:if="{{loading}}">加载中
...
</text>
<text wx:if="{{ finished}}">暂无更多</text>
<text wx:if="{{ finished}}">暂无更多</text>
</view>
</view>
</view>
</view>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment