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
1c48ebd8
Commit
1c48ebd8
authored
Jan 28, 2021
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品列表滚动加载
parent
774db429
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
178 additions
and
75 deletions
+178
-75
src/pages/home/index.vue
+11
-2
static/nativeComponents/GoodsList/GoodsItem/index.wxml
+5
-1
static/nativeComponents/GoodsList/index.js
+73
-52
static/nativeComponents/GoodsList/index.wxml
+3
-0
static/nativeComponents/module/WaterfallFlow/index.js
+76
-19
static/nativeComponents/module/WaterfallFlow/index.wxml
+10
-1
No files found.
src/pages/home/index.vue
View file @
1c48ebd8
<
template
>
<
template
>
<div
class=
"domain"
>
<div
class=
"domain"
>
<!--
<goods-list
id=
"goodsList"
></goods-list>
-->
<!--
<goods-list
id=
"goodsList"
></goods-list>
-->
<scroll-view
@
scroll=
"scrolls"
@
scrolltolower=
"scrolltolower"
style=
"height:100vh;"
scroll-y=
"true"
>
<div
v-for=
"(item,index) in pageData"
:key=
"index"
>
<div
v-for=
"(item,index) in pageData"
:key=
"index"
>
<div
v-if=
"item.componentCode=='banner'"
>
<div
v-if=
"item.componentCode=='banner'"
>
<banner
:datas=
"item"
></banner>
<banner
:datas=
"item"
></banner>
</div>
</div>
<div
v-else-if=
"item.componentCode=='goods-list'
"
>
<div
v-else-if=
"item.componentCode=='goods-list'"
style=
"height:100%;
"
>
<goods-list
:datas=
"item"
></goods-list>
<goods-list
class=
"goodsListItem"
:datas=
"item"
></goods-list>
</div>
</div>
</div>
</div>
</scroll-view>
<!--
<image
<!--
<image
src=
"http://cdn.mayi888.com/public/jpg/33ff0efc-96b5-4044-a65a-07799dfe98e1.jpg?x-oss-process=image/resize,limit_1,w_750"
src=
"http://cdn.mayi888.com/public/jpg/33ff0efc-96b5-4044-a65a-07799dfe98e1.jpg?x-oss-process=image/resize,limit_1,w_750"
></image>
></image>
...
@@ -49,6 +51,13 @@ export default {
...
@@ -49,6 +51,13 @@ export default {
this
.
pageData
=
JSON
.
parse
(
this
.
pageInfo
.
pageData
);
this
.
pageData
=
JSON
.
parse
(
this
.
pageInfo
.
pageData
);
console
.
log
(
'36'
,
this
.
pageData
)
console
.
log
(
'36'
,
this
.
pageData
)
},
},
scrolls
(
el
){
console
.
log
(
'scroll'
)
this
.
$mp
.
page
.
selectComponent
(
".goodsListItem"
).
getScroll
(
el
);
},
scrolltolower
(){
console
.
log
(
"scrolltolower"
)
}
},
},
};
};
</
script
>
</
script
>
...
...
static/nativeComponents/GoodsList/GoodsItem/index.wxml
View file @
1c48ebd8
...
@@ -71,7 +71,11 @@
...
@@ -71,7 +71,11 @@
<!-- 商品详情 -->
<!-- 商品详情 -->
<view class="info" style="text-align:{{datas.componentData['initcharAlign']}};">
<view class="info" style="text-align:{{datas.componentData['initcharAlign']}};">
<view class="info-top flex">
<view class="info-top flex">
<view class="name" wx:if="{{datas.componentData['nameShow']}}">
<view
class="name"
wx:if="{{datas.componentData['nameShow']}}"
style="color:{{datas.componentData['nameColor']}};font-weight:{{datas.componentData['nameFontWeight']}};font-size:{{datas.componentData['nameFontSize']}}em;"
>
{{items!=null?items['productName']:'名称'}}
{{items!=null?items['productName']:'名称'}}
</view>
</view>
<view
<view
...
...
static/nativeComponents/GoodsList/index.js
View file @
1c48ebd8
...
@@ -16,7 +16,10 @@ const componentOptions = {
...
@@ -16,7 +16,10 @@ const componentOptions = {
isPageHidden
:
false
,
// 页面是否处于隐藏状态
isPageHidden
:
false
,
// 页面是否处于隐藏状态
titleIcon
:
""
,
titleIcon
:
""
,
classificationLoadPage
:
1
,
classificationLoadPage
:
1
,
classificationLoadNum
:
10
classificationLoadNum
:
10
,
queryProductInfoLoading
:
false
,
loading
:
false
,
finished
:
false
},
},
// 数据监听器
// 数据监听器
observers
:
{},
observers
:
{},
...
@@ -65,7 +68,9 @@ const componentOptions = {
...
@@ -65,7 +68,9 @@ const componentOptions = {
titleIcon
titleIcon
}
=
this
.
data
.
datas
.
componentData
;
}
=
this
.
data
.
datas
.
componentData
;
angleSignImg
=
DFSImg
(
angleSignImg
);
angleSignImg
=
DFSImg
(
angleSignImg
);
if
(
titleIcon
)
{
titleIcon
=
DFSImg
(
titleIcon
);
titleIcon
=
DFSImg
(
titleIcon
);
}
this
.
setData
({
this
.
setData
({
"data.datas.componentData.angleSignImg"
:
angleSignImg
,
"data.datas.componentData.angleSignImg"
:
angleSignImg
,
titleIcon
titleIcon
...
@@ -91,39 +96,35 @@ const componentOptions = {
...
@@ -91,39 +96,35 @@ const componentOptions = {
},
},
getProductList
(
code
,
type
)
{
getProductList
(
code
,
type
)
{
let
{
goodsList
,
goodsSort
}
=
this
.
data
.
datas
.
componentData
;
let
{
goodsList
,
goodsSort
}
=
this
.
data
.
datas
.
componentData
;
let
{
classificationLoadPage
,
loading
,
finished
,
queryProductInfoLoading
}
=
this
.
data
;
if
(
queryProductInfoLoading
==
true
)
{
return
;
}
this
.
setData
({
queryProductInfoLoading
:
true
});
// type 1初始化 2滚动加载
// type 1初始化 2滚动加载
//分类查
//分类查
if
(
code
==
1
)
{
if
(
code
==
1
)
{
let
query
=
{
if
(
type
==
1
)
{
categoryId
:
this
.
data
.
datas
.
componentData
.
categoryId
,
classificationLoadPage
=
1
;
page
:
this
.
showRowNum
()
}
else
{
?
1
classificationLoadPage
++
;
:
this
.
data
.
datas
.
componentData
.
classificationLoadPage
,
// 当前页
loading
=
true
;
rows
:
this
.
showRowNum
()
}
?
this
.
getItemNum
()
this
.
setData
({
classificationLoadPage
,
loading
});
:
this
.
classificationLoadNum
,
// 一页多少条
let
query
=
{
categoryId
:
this
.
data
.
datas
.
componentData
.
categoryId
,
page
:
this
.
showRowNum
()
?
classificationLoadPage
:
1
,
rows
:
this
.
showRowNum
()
?
this
.
data
.
classificationLoadNum
:
this
.
getItemNum
(),
sortColumn
:
goodsSort
,
sortType
:
goodsSort
!=
2
?
1
:
0
,
whetherShowSoldOutGoods
:
this
.
data
.
datas
.
componentData
.
whetherShowSoldOutGoods
,
whetherQueryCollectCount
:
true
,
whetherUseVirtualSalesQty
:
true
,
whetherUseVirtualCollectCount
:
true
,
whetherFindDistributionCommission
:
this
.
whetherFindDistributionCommission
,
whetherFindRecommendedCardFlag
:
this
.
data
.
datas
.
componentData
.
vipPrice
?
1
:
0
,
whetherShowGoodsDefaultTagFlag
:
this
.
data
.
datas
.
componentData
.
marketingTag
?
1
:
0
,
whetherFindMultiShopFlag
:
1
};
// 当前页 // 一页多少条 //查询销售数量 //查询收藏数 //是否使用虚拟销售数量 //是否使用虚拟收藏人数 //是否查询商品佣金(0:不查询,1:展示,为空不查佣金) //是否查询会员价 1是 0否 //是否展示营销标签 1是 0否 //是否查询多商户 //商城使用
sortColumn
:
this
.
data
.
datas
.
componentData
.
goodsSort
,
sortType
:
this
.
data
.
datas
.
componentData
.
goodsSort
!=
2
?
1
:
0
,
whetherShowSoldOutGoods
:
this
.
data
.
datas
.
componentData
.
whetherShowSoldOutGoods
,
//查询销售数量
whetherQueryCollectCount
:
true
,
//查询收藏数
whetherUseVirtualSalesQty
:
true
,
//是否使用虚拟销售数量
whetherUseVirtualCollectCount
:
true
,
//是否使用虚拟收藏人数
whetherFindDistributionCommission
:
this
.
whetherFindDistributionCommission
,
//是否查询商品佣金(0:不查询,1:展示,为空不查佣金)
whetherFindRecommendedCardFlag
:
this
.
data
.
datas
.
componentData
.
vipPrice
?
1
:
0
,
//是否查询会员价 1是 0否
whetherShowGoodsDefaultTagFlag
:
this
.
data
.
datas
.
componentData
.
marketingTag
?
1
:
0
,
//是否展示营销标签 1是 0否
whetherFindMultiShopFlag
:
1
//是否查询多商户 //商城使用
};
goodsApi
.
queryProductInfo
(
query
).
then
(
res
=>
{
goodsApi
.
queryProductInfo
(
query
).
then
(
res
=>
{
this
.
setData
({
loading
:
false
,
queryProductInfoLoading
:
false
});
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
let
goodsList
=
res
.
data
.
data
.
list
;
let
goodsLists
=
res
.
data
.
data
.
list
;
this
.
goodsListVal
(
goodsList
);
if
(
type
==
1
)
{
goodsList
=
goodsLists
;
}
else
{
goodsList
=
[...
goodsList
,
...
goodsLists
];
}
if
(
goodsLists
&&
goodsLists
.
length
<
10
)
{
this
.
setData
({
finished
:
true
});
}
this
.
goodsListVal
(
goodsList
,
type
);
}
}
});
});
}
else
{
}
else
{
...
@@ -177,13 +178,13 @@ const componentOptions = {
...
@@ -177,13 +178,13 @@ const componentOptions = {
goodsApi
.
queryMoreProductInfo
(
moreQuery
).
then
(
res
=>
{
goodsApi
.
queryMoreProductInfo
(
moreQuery
).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
)
{
if
(
res
.
data
.
code
==
200
)
{
goodsList
=
res
.
data
.
data
;
goodsList
=
res
.
data
.
data
;
this
.
goodsListVal
(
goodsList
);
this
.
goodsListVal
(
goodsList
,
1
);
}
}
});
});
},
},
goodsListVal
(
goodsList
)
{
goodsListVal
(
goodsList
,
type
)
{
console
.
log
(
goodsList
,
"------------goodsListVal"
)
console
.
log
(
goodsList
,
"------------goodsListVal"
);
goodsList
.
forEach
((
item
,
index
)
=>
{
goodsList
.
forEach
((
item
,
index
)
=>
{
item
.
marketingTag
=
item
.
defaultTags
item
.
marketingTag
=
item
.
defaultTags
?
this
.
filtermark
(
?
this
.
filtermark
(
item
.
defaultTags
,
item
.
defaultTags
,
...
@@ -191,21 +192,21 @@ const componentOptions = {
...
@@ -191,21 +192,21 @@ const componentOptions = {
)
)
:
[];
:
[];
item
.
shopLogoUrl
=
DFSImg
(
item
.
shopLogoUrl
);
item
.
shopLogoUrl
=
DFSImg
(
item
.
shopLogoUrl
);
item
.
coverImage
=
DFSImg
(
item
.
coverImage
);
item
.
coverImage
=
DFSImg
(
item
.
coverImage
,
100
,
100
,
0
);
item
.
productImgUrl
=
DFSImg
(
item
.
productImgUrl
);
item
.
productImgUrl
=
DFSImg
(
item
.
productImgUrl
,
100
,
100
,
0
);
item
.
minPrice
=
Number
(
item
.
minPrice
).
toFixed
(
2
);
item
.
minPrice
=
Number
(
item
.
minPrice
).
toFixed
(
2
);
item
.
qty
=
Number
(
item
.
qty
);
item
.
qty
=
Number
(
item
.
qty
);
item
.
saleQty
=
Number
(
item
.
saleQty
);
item
.
saleQty
=
Number
(
item
.
saleQty
);
item
.
totalCollectionCount
=
Number
(
item
.
totalCollectionCount
)
||
0
;
item
.
totalCollectionCount
=
Number
(
item
.
totalCollectionCount
)
||
0
;
item
.
minPriceAfterRecommendedCardPriceTable
=
item
.
minPriceAfterRecommendedCardPriceTable
?
item
.
minPriceAfterRecommendedCardPriceTable
=
item
.
minPriceAfterRecommendedCardPriceTable
Number
(
item
.
minPriceAfterRecommendedCardPriceTable
):
""
;
?
Number
(
item
.
minPriceAfterRecommendedCardPriceTable
)
item
.
minProductGoodsCommission
=
item
.
minProductGoodsCommission
?
:
""
;
Number
(
item
.
minProductGoodsCommission
).
toFixed
(
2
)
:
0
;
item
.
minProductGoodsCommission
=
item
.
minProductGoodsCommission
item
.
minGoodsSuggestedRetailPrice
=
item
?
Number
(
item
.
minProductGoodsCommission
).
toFixed
(
2
)
.
minGoodsSuggestedRetailPrice
?
Number
(
:
0
;
item
.
minGoodsSuggestedRetailPrice
item
.
minGoodsSuggestedRetailPrice
=
item
.
minGoodsSuggestedRetailPrice
)
?
Number
(
item
.
minGoodsSuggestedRetailPrice
).
toFixed
(
2
)
.
toFixed
(
2
)
:
""
;
:
""
;
item
.
showVipPrice
=
this
.
showVipPrice
(
item
,
index
);
item
.
showVipPrice
=
this
.
showVipPrice
(
item
,
index
);
item
.
showVipTag
=
this
.
showVipTag
(
item
,
index
);
item
.
showVipTag
=
this
.
showVipTag
(
item
,
index
);
if
(
item
.
saleTime
)
{
if
(
item
.
saleTime
)
{
...
@@ -217,9 +218,17 @@ const componentOptions = {
...
@@ -217,9 +218,17 @@ const componentOptions = {
this
.
setData
({
this
.
setData
({
"datas.componentData.goodsList"
:
goodsList
"datas.componentData.goodsList"
:
goodsList
});
});
if
(
type
==
1
)
{
// 初始化
if
(
this
.
selectComponent
(
"#waterfallFlow"
))
{
if
(
this
.
selectComponent
(
"#waterfallFlow"
))
{
this
.
selectComponent
(
"#waterfallFlow"
).
initList
();
this
.
selectComponent
(
"#waterfallFlow"
).
initList
();
}
}
}
else
{
// 滚动加载
if
(
this
.
selectComponent
(
"#waterfallFlow"
))
{
this
.
selectComponent
(
"#waterfallFlow"
).
reLoadPro
();
}
}
},
0
);
},
0
);
},
},
getSaleTime
(
val
)
{
getSaleTime
(
val
)
{
...
@@ -249,9 +258,9 @@ const componentOptions = {
...
@@ -249,9 +258,9 @@ const componentOptions = {
}
}
},
},
showRowNum
()
{
showRowNum
()
{
return
!
(
return
(
this
.
data
.
datas
.
componentData
.
moreShow
==
false
&&
this
.
data
.
datas
.
componentData
.
moreShow
==
false
&&
this
.
data
.
datas
.
componentData
.
getS
tyle
==
"waterfall"
&&
this
.
data
.
datas
.
componentData
.
s
tyle
==
"waterfall"
&&
this
.
data
.
datas
.
componentData
.
goodsSource
==
"classify"
this
.
data
.
datas
.
componentData
.
goodsSource
==
"classify"
);
);
},
},
...
@@ -278,21 +287,33 @@ const componentOptions = {
...
@@ -278,21 +287,33 @@ const componentOptions = {
}
}
return
showFlag
;
return
showFlag
;
},
},
showVipTag
(
item
,
index
)
{
showVipTag
(
item
,
index
)
{
// 索引 0 显示价格 1显示名称
// 索引 0 显示价格 1显示名称
let
showFlag
=
false
;
let
showFlag
=
false
;
let
vipPrice
=
item
[
"minPriceAfterRecommendedCardPriceTable"
];
let
vipPrice
=
item
[
"minPriceAfterRecommendedCardPriceTable"
];
let
showTag
=
item
[
"recommendedCardMinPricePriceTableName"
];
let
showTag
=
item
[
"recommendedCardMinPricePriceTableName"
];
if
(
if
(
vipPrice
&&
showTag
&&
Number
(
vipPrice
)
<=
Number
(
item
[
"minPrice"
]))
{
vipPrice
&&
showTag
&&
Number
(
vipPrice
)
<=
Number
(
item
[
"minPrice"
])
)
{
showFlag
=
true
;
showFlag
=
true
;
}
}
return
showFlag
;
return
showFlag
;
},
getScroll
(
el
)
{
// 是指定分类且不显示查看更多的瀑布流组件滚动加载
let
{
goodsSource
,
moreShow
,
style
}
=
this
.
data
.
datas
.
componentData
;
if
(
goodsSource
==
"classify"
&&
moreShow
==
false
&&
style
==
"waterfall"
)
{
this
.
selectComponent
(
"#waterfallFlow"
).
getScroll
(
el
);
}
}
},
},
// 分页加载
onLoad
()
{
console
.
log
(
"---触发分页加载"
);
this
.
getProductList
(
1
,
2
);
}
}
};
};
Component
(
componentOptions
);
Component
(
componentOptions
);
static/nativeComponents/GoodsList/index.wxml
View file @
1c48ebd8
...
@@ -63,6 +63,9 @@
...
@@ -63,6 +63,9 @@
datas="{{datas}}"
datas="{{datas}}"
padding="{{datas.componentData.proGap}}"
padding="{{datas.componentData.proGap}}"
wx:if="{{datas.componentData.goodsList}}"
wx:if="{{datas.componentData.goodsList}}"
bindonLoad="onLoad"
loading="{{loading}}"
finished="{{finished}}"
></waterfall-flow>
></waterfall-flow>
</view>
</view>
<!-- 横向列表 -->
<!-- 横向列表 -->
...
...
static/nativeComponents/module/WaterfallFlow/index.js
View file @
1c48ebd8
...
@@ -13,8 +13,17 @@ Component({
...
@@ -13,8 +13,17 @@ Component({
},
},
padding
:
{
padding
:
{
type
:
Number
type
:
Number
},
loading
:
{
type
:
Boolean
},
finished
:
{
type
:
Boolean
}
}
},
},
onPageScroll
(
e
)
{
console
.
log
(
e
);
},
lifetimes
:
{
lifetimes
:
{
created
()
{
created
()
{
console
.
log
(
"进入组件created"
);
console
.
log
(
"进入组件created"
);
...
@@ -26,7 +35,14 @@ Component({
...
@@ -26,7 +35,14 @@ Component({
},
},
ready
()
{
ready
()
{
console
.
log
(
"进入组件ready"
);
console
.
log
(
"进入组件ready"
);
// this.reLoadPro();
let
_this
=
this
;
let
{
clientHeight
}
=
this
.
data
;
wx
.
getSystemInfo
({
success
:
function
(
res
)
{
let
clientHeight
=
parseInt
(
res
.
windowHeight
);
_this
.
setData
({
clientHeight
});
}
});
}
}
},
},
observers
:
{},
observers
:
{},
...
@@ -36,50 +52,71 @@ Component({
...
@@ -36,50 +52,71 @@ Component({
//列高度数组
//列高度数组
waterfallDeviationHeight
:
[
0
,
0
],
waterfallDeviationHeight
:
[
0
,
0
],
contentList
:
[],
contentList
:
[],
inj
:
0
inj
:
0
,
clientHeight
:
0
,
//窗口高度
goodsNum
:
0
,
},
},
methods
:
{
methods
:
{
// 初始化数组
// 初始化数组
initList
()
{
initList
()
{
// 初始化容器
// 初始化容器
let
contentList
=
this
.
data
.
contentList
;
let
{
contentList
,
waterfallDeviationHeight
}
=
this
.
data
;
contentList
[
0
]
=
[];
contentList
[
0
]
=
[];
contentList
[
1
]
=
[];
contentList
[
1
]
=
[];
this
.
setData
({
contentList
});
waterfallDeviationHeight
=
[
0
,
0
];
this
.
setData
({
contentList
,
waterfallDeviationHeight
});
console
.
log
(
this
.
data
.
note
,
"-------------------185"
);
console
.
log
(
this
.
data
.
note
,
"-------------------185"
);
this
.
reLoadPro
();
this
.
reLoadPro
();
},
},
async
reLoadPro
()
{
async
reLoadPro
()
{
let
_this
=
this
;
this
.
setHeight
(
this
.
data
.
goodsNum
)
;
this
.
set
Height
(
0
);
this
.
set
Data
({
goodsNum
:
this
.
data
.
note
.
length
>
0
?
this
.
data
.
note
.
length
+
1
:
0
}
);
},
},
setHeight
(
i
)
{
setHeight
(
i
)
{
let
_this
=
this
;
let
_this
=
this
;
let
item
=
this
.
data
.
note
[
i
];
let
item
=
this
.
data
.
note
[
i
];
console
.
log
(
i
,
"---------------i"
);
//
console.log(i, "---------------i");
console
.
log
(
//
console.log(
this
.
data
.
waterfallDeviationHeight
,
//
this.data.waterfallDeviationHeight,
"-------waterfallDeviationHeight"
//
"-------waterfallDeviationHeight"
);
//
);
let
minIndex
=
this
.
filterMin
();
let
minIndex
=
this
.
filterMin
();
console
.
log
(
minIndex
,
"---------------126"
);
//
console.log(minIndex, "---------------126");
let
contentList
=
this
.
data
.
contentList
;
let
contentList
=
this
.
data
.
contentList
;
contentList
[
minIndex
].
push
(
item
);
contentList
[
minIndex
].
push
(
item
);
this
.
setData
({
contentList
});
this
.
setData
({
contentList
});
const
queryDom
=
wx
.
createSelectorQuery
().
in
(
this
);
_this
queryDom
.
select
(
`.item
${
minIndex
}
`
).
boundingClientRect
();
.
createSelectorQuery
()
queryDom
.
exec
(
res
=>
{
.
select
(
`.item
${
minIndex
}
`
)
res
[
0
].
height
;
.
boundingClientRect
(
function
(
res
)
{
console
.
log
(
res
[
0
],
"--------------res"
);
if
(
res
)
{
res
.
height
;
console
.
log
(
res
,
"--------------res"
);
let
waterfallDeviationHeight
=
_this
.
data
.
waterfallDeviationHeight
;
let
waterfallDeviationHeight
=
_this
.
data
.
waterfallDeviationHeight
;
waterfallDeviationHeight
[
minIndex
]
=
res
[
0
]
.
height
;
waterfallDeviationHeight
[
minIndex
]
=
res
.
height
;
_this
.
setData
({
waterfallDeviationHeight
});
_this
.
setData
({
waterfallDeviationHeight
});
if
(
i
>=
_this
.
data
.
note
.
length
-
1
)
{
if
(
i
>=
_this
.
data
.
note
.
length
-
1
)
{
return
;
return
;
}
}
i
++
;
i
++
;
_this
.
setHeight
(
i
);
_this
.
setHeight
(
i
);
});
}
})
.
exec
();
// const queryDom = wx.createSelectorQuery().in(this);
// queryDom.select(`.item${minIndex}`).boundingClientRect();
// queryDom.exec(res => {
// res[0].height;
// console.log(res[0], "--------------res");
// let waterfallDeviationHeight = _this.data.waterfallDeviationHeight;
// waterfallDeviationHeight[minIndex] = res[0].height;
// _this.setData({ waterfallDeviationHeight });
// if (i >= _this.data.note.length - 1) {
// return;
// }
// i++;
// _this.setHeight(i);
// });
},
},
filterMin
()
{
filterMin
()
{
let
val
=
Math
.
min
.
apply
(
null
,
this
.
data
.
waterfallDeviationHeight
);
let
val
=
Math
.
min
.
apply
(
null
,
this
.
data
.
waterfallDeviationHeight
);
...
@@ -101,6 +138,26 @@ Component({
...
@@ -101,6 +138,26 @@ Component({
ev
.
target
.
dataset
.
id
,
ev
.
target
.
dataset
.
id
,
"-----------------------219"
"-----------------------219"
);
);
},
getScroll
(
el
)
{
let
{
finished
}
=
this
.
properties
;
let
_this
=
this
;
_this
.
createSelectorQuery
()
.
select
(
"#waterfallFlow"
)
.
boundingClientRect
(
function
(
res
)
{
if
(
res
)
{
console
.
log
(
el
,
"-------------118"
);
console
.
log
(
res
,
"---------------35"
);
let
scrollTop
=
parseInt
(
el
.
target
.
scrollTop
);
let
domHeight
=
parseInt
(
res
.
height
);
// 窗口高度+滚动高度等于 = 元素整体高度 -(预留一段距离加载) 触发父组件查询接口
if
(
scrollTop
+
_this
.
data
.
clientHeight
>=
domHeight
-
150
&&
finished
==
false
)
{
_this
.
triggerEvent
(
"onLoad"
);
}
}
})
.
exec
();
}
}
}
}
});
});
static/nativeComponents/module/WaterfallFlow/index.wxml
View file @
1c48ebd8
<!--瀑布流组件-->
<!--瀑布流组件-->
<view class="waterfallFlow" style="--proGap:{{padding}}rpx">
<view
class="waterfallFlow"
id="waterfallFlow"
style="--proGap:{{padding}}rpx"
>
<view class="container flex">
<view class="container flex">
<view
<view
wx:for="{{contentList}}"
wx:for="{{contentList}}"
...
@@ -21,5 +25,10 @@
...
@@ -21,5 +25,10 @@
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 上拉加载底部展示 -->
<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="{{ finished}}">暂无更多</text>
</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