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