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
303302ae
Commit
303302ae
authored
Jan 25, 2024
by
侯体倬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
轮播优化
parent
e176e772
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
+19
-11
static/nativeComponents/GoodsList/index.js
+19
-11
No files found.
static/nativeComponents/GoodsList/index.js
View file @
303302ae
...
...
@@ -223,15 +223,12 @@ const componentOptions = {
this
.
getInterList
(
2
);
}
}
this
.
getSwipeLen
();
wx
.
createSelectorQuery
().
selectAll
(
`.goodsListItemIndex
${
this
.
data
.
datasIndex
}
>>>.goods-item`
).
boundingClientRect
(
function
(
rects
)
{
console
.
log
(
rects
[
0
],
'--rects'
,
_this
.
data
.
datasIndex
)
if
(
rects
[
0
]
&&
rects
[
0
].
height
)
{
_this
.
setData
({
swiperHeight
:
rects
[
0
].
height
})
}
}).
exec
();
// 判断是否为滑动组件
if
(
this
.
data
.
datas
.
componentData
.
style
===
'swipe'
)
{
this
.
getSwipeLen
();
this
.
getSwipeHeight
();
}
},
handleSwipeChange
(
e
)
{
this
.
setData
({
currentSwiperIndex
:
e
.
detail
.
current
})
...
...
@@ -252,6 +249,17 @@ const componentOptions = {
const
total
=
(
index
+
1
)
*
columnNum
;
return
total
>
goodsListLen
?
goodsListLen
-
(
index
*
columnNum
)
:
columnNum
},
getSwipeHeight
()
{
wx
.
createSelectorQuery
().
in
(
this
).
selectAll
(
'.goods-item'
).
boundingClientRect
((
rects
)
=>
{
if
(
rects
)
{
let
maxHeight
=
0
;
rects
.
forEach
(
item
=>
{
if
(
item
.
height
>
maxHeight
)
maxHeight
=
item
.
height
;
});
this
.
setData
({
swiperHeight
:
maxHeight
});
}
}).
exec
();
},
getProductList
(
code
,
type
)
{
let
{
goodsSort
,
attributeValueList
}
=
this
.
data
.
datas
.
componentData
;
let
goodsList
=
[];
...
...
@@ -553,8 +561,8 @@ const componentOptions = {
lazyloading
(){
var
that
=
this
let
storageDatasList
=
this
.
getStorageSync
(
'storageDatasList'
)
||
[]
let
style
=
storageDatasList
[
that
.
data
.
datasIndex
].
style
||
""
;
const
tempItem
=
storageDatasList
[
that
.
data
.
datasIndex
];
let
style
=
tempItem
?
tempItem
.
style
:
""
;
if
(
!
style
)
return
;
let
type
=
''
if
(
style
==
'list'
||
style
==
'rowList'
){
...
...
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