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
d0b9a922
Commit
d0b9a922
authored
Mar 21, 2024
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品列表轮播改参数
parent
c3ce6cdf
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
+12
-13
static/nativeComponents/GoodsList/index.js
+8
-9
static/nativeComponents/GoodsList/index.wxml
+4
-4
No files found.
static/nativeComponents/GoodsList/index.js
View file @
d0b9a922
...
@@ -223,18 +223,12 @@ const componentOptions = {
...
@@ -223,18 +223,12 @@ const componentOptions = {
this
.
getInterList
(
2
);
this
.
getInterList
(
2
);
}
}
}
}
// 判断是否为滑动组件
if
(
this
.
data
.
datas
.
componentData
.
style
===
'swipe'
)
{
this
.
getSwipeLen
();
this
.
getSwipeHeight
();
}
},
},
handleSwipeChange
(
e
)
{
handleSwipeChange
(
e
)
{
this
.
setData
({
currentSwiperIndex
:
e
.
detail
.
current
})
this
.
setData
({
currentSwiperIndex
:
e
.
detail
.
current
})
},
},
getSwipeLen
()
{
getSwipeLen
()
{
const
goodsListLen
=
this
.
data
.
datas
.
componentData
.
goodsList
.
length
||
0
;
const
goodsListLen
=
this
.
data
.
pageGoodsList
[
this
.
data
.
datasIndex
]
.
length
||
0
;
const
len
=
Math
.
ceil
((
goodsListLen
/
this
.
data
.
datas
.
componentData
.
columnNum
));
const
len
=
Math
.
ceil
((
goodsListLen
/
this
.
data
.
datas
.
componentData
.
columnNum
));
const
result
=
[];
const
result
=
[];
for
(
let
i
=
0
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
;
i
<
len
;
i
++
)
{
...
@@ -244,7 +238,7 @@ const componentOptions = {
...
@@ -244,7 +238,7 @@ const componentOptions = {
this
.
setData
({
swipeInfo
:
result
});
this
.
setData
({
swipeInfo
:
result
});
},
},
getSwipeItemLen
(
index
)
{
getSwipeItemLen
(
index
)
{
const
goodsListLen
=
this
.
data
.
datas
.
componentData
.
goodsList
.
length
||
0
;
const
goodsListLen
=
this
.
data
.
pageGoodsList
[
this
.
data
.
datasIndex
]
.
length
||
0
;
const
columnNum
=
this
.
data
.
datas
.
componentData
.
columnNum
;
const
columnNum
=
this
.
data
.
datas
.
componentData
.
columnNum
;
const
total
=
(
index
+
1
)
*
columnNum
;
const
total
=
(
index
+
1
)
*
columnNum
;
return
total
>
goodsListLen
?
goodsListLen
-
(
index
*
columnNum
)
:
columnNum
return
total
>
goodsListLen
?
goodsListLen
-
(
index
*
columnNum
)
:
columnNum
...
@@ -507,7 +501,12 @@ const componentOptions = {
...
@@ -507,7 +501,12 @@ const componentOptions = {
this
.
selectComponent
(
"#waterfallFlow"
).
reLoadPro
(
list
);
this
.
selectComponent
(
"#waterfallFlow"
).
reLoadPro
(
list
);
}
}
}
}
})
});
// 判断是否为滑动组件
if
(
this
.
data
.
datas
.
componentData
.
style
===
'swipe'
)
{
this
.
getSwipeLen
();
this
.
getSwipeHeight
();
}
});
});
},
},
...
...
static/nativeComponents/GoodsList/index.wxml
View file @
d0b9a922
...
@@ -154,13 +154,13 @@
...
@@ -154,13 +154,13 @@
<!-- 轮播滑动 -->
<!-- 轮播滑动 -->
<view wx:if="{{datas.componentData.style === 'swipe' && datas.componentData.goodsList.length > 0}}" style="position:relative;">
<view wx:if="{{datas.componentData.style === 'swipe' && datas.componentData.goodsList.length > 0}}" style="position:relative;">
<swiper bindchange="handleSwipeChange" style="height: {{swiperHeight}}px">
<swiper bindchange="handleSwipeChange" style="height: {{swiperHeight}}px">
<block wx:for="{{swipeInfo}}">
<block wx:for="{{swipeInfo}}"
wx:key="index"
>
<swiper-item>
<swiper-item>
<view class="goods-item" style="display: grid;gap:{{datas.componentData.proGap*2}}rpx;grid-template-columns:repeat({{datas.componentData.columnNum}}, 1fr)">
<view class="goods-item" style="display: grid;gap:{{datas.componentData.proGap*2}}rpx;grid-template-columns:repeat({{datas.componentData.columnNum}}, 1fr)">
<view wx:for="{{item}}" wx:for-index="indey" style="display:flex;">
<view wx:for="{{item}}" wx:
key="indey" wx:
for-index="indey" style="display:flex;">
<goods-item
<goods-item
datas="{{datas}}"
datas="{{datas}}"
items="{{
datas.componentData.goodsList
[index * datas.componentData.columnNum + indey]}}"
items="{{
pageGoodsList[datasIndex]
[index * datas.componentData.columnNum + indey]}}"
indexs="{{index}}"
indexs="{{index}}"
></goods-item>
></goods-item>
</view>
</view>
...
@@ -169,7 +169,7 @@
...
@@ -169,7 +169,7 @@
</block>
</block>
</swiper>
</swiper>
<view class="flex custom-indicator" wx:if="{{swiperHeight > 0}}">
<view class="flex custom-indicator" wx:if="{{swiperHeight > 0}}">
<block wx:for="{{swipeInfo}}">
<block wx:for="{{swipeInfo}}"
wx:key="index"
>
<view class="custom-indicator__item {{currentSwiperIndex === index && 'custom-indicator__active'}}"></view>
<view class="custom-indicator__item {{currentSwiperIndex === index && 'custom-indicator__active'}}"></view>
</block>
</block>
</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