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
73de9c7c
Commit
73de9c7c
authored
Sep 09, 2022
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品列表组件优化
parent
db3d6d91
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
+15
-5
src/pages/home/index.vue
+1
-1
static/nativeComponents/GoodsList/index.js
+12
-4
static/nativeComponents/module/WaterfallFlow/index.js
+2
-0
No files found.
src/pages/home/index.vue
View file @
73de9c7c
...
...
@@ -453,7 +453,7 @@ export default {
// 滚动节流方法
onPageScroll
:
tool
.
throttle
(
function
(
el
)
{
// console.log(el);
this
.
scrolls
(
el
)
this
.
scrolls
(
el
[
0
]
)
},
200
),
methods
:
{
...
...
static/nativeComponents/GoodsList/index.js
View file @
73de9c7c
...
...
@@ -236,8 +236,9 @@ const componentOptions = {
this
.
setData
({
classificationLoadPage
,
loading
});
let
query
=
{
categoryId
:
this
.
data
.
datas
.
componentData
.
categoryId
,
page
:
this
.
showRowNum
()
?
classificationLoadPage
:
1
,
rows
:
this
.
data
.
datas
.
componentData
.
classificationLoadNum
,
page
:
classificationLoadPage
,
// rows: this.data.datas.componentData.classificationLoadNum,
rows
:
this
.
showRowNum
()
?
this
.
data
.
classificationLoadNum
:
this
.
getItemNum
(),
sortColumn
:
goodsSort
,
sortType
:
goodsSort
!=
2
?
1
:
0
,
whetherShowSoldOutGoods
:
this
.
data
.
datas
.
componentData
...
...
@@ -275,7 +276,7 @@ const componentOptions = {
}
else
{
goodsList
=
[...
goodsList
,
...
goodsLists
];
}
if
(
goodsLists
&&
goodsLists
.
length
<
10
)
{
if
(
goodsLists
&&
goodsLists
.
length
<
query
.
rows
)
{
this
.
setData
({
finished
:
true
});
}
this
.
goodsListVal
(
goodsList
,
type
);
...
...
@@ -529,6 +530,13 @@ const componentOptions = {
return
new
Date
(
val
.
replace
(
/-/g
,
"/"
)).
getTime
()
-
new
Date
().
getTime
();
},
getItemNum
()
{
if
(
this
.
data
.
datas
.
componentData
[
'goodsSource'
]
==
'classify'
)
{
return
this
.
data
.
classificationLoadNum
}
// 瀑布流模式默认查6条
if
(
this
.
data
.
datas
.
componentData
.
style
==
"waterfall"
&&
this
.
data
.
datas
.
componentData
[
"goodsSource"
]
==
"specifyFilter"
){
return
6
;
}
//数量
if
(
this
.
data
.
datas
.
componentData
.
style
===
"list"
&&
...
...
@@ -599,7 +607,7 @@ const componentOptions = {
console
.
log
(
'goodsSource, moreShow, style'
,
goodsSource
,
moreShow
,
style
);
this
.
lazyloading
()
if
(
goodsSource
==
"classify"
&&
(
goodsSource
==
"classify"
||
goodsSource
==
"specifyFilter"
)
&&
moreShow
==
false
&&
style
==
"waterfall"
)
{
...
...
static/nativeComponents/module/WaterfallFlow/index.js
View file @
73de9c7c
...
...
@@ -158,6 +158,7 @@ Component({
);
},
getScroll
(
el
)
{
console
.
log
(
el
,
'--------------161'
)
let
{
finished
}
=
this
.
properties
;
let
_this
=
this
;
_this
...
...
@@ -168,6 +169,7 @@ Component({
let
scrollTop
=
parseInt
(
el
.
scrollTop
);
let
domHeight
=
parseInt
(
res
.
height
);
// 窗口高度+滚动高度等于 = 元素整体高度 -(预留一段距离加载) 触发父组件查询接口
console
.
log
(
scrollTop
,
finished
,
'--------------finished'
)
if
(
scrollTop
+
_this
.
data
.
clientHeight
>=
domHeight
-
150
&&
finished
==
false
...
...
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