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
8576c3d2
Commit
8576c3d2
authored
Nov 08, 2023
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商品列表轮播加高度
parent
d7247042
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
10 deletions
+14
-10
static/nativeComponents/GoodsList/index.js
+10
-6
static/nativeComponents/GoodsList/index.wxml
+4
-4
No files found.
static/nativeComponents/GoodsList/index.js
View file @
8576c3d2
...
...
@@ -70,12 +70,7 @@ const componentOptions = {
clientHeight
:
0
,
//窗口高度
swipeInfo
:
[],
currentSwiperIndex
:
0
,
swiperTypeHeightList
:
{
1
:
"510px"
,
2
:
"300px"
,
3
:
"256px"
,
4
:
"220px"
,
}
swiperHeight
:
0
,
},
// 数据监听器
observers
:
{},
...
...
@@ -184,6 +179,7 @@ const componentOptions = {
}
},
init
()
{
let
_this
=
this
;
let
{
goodsType
,
goodsSource
,
...
...
@@ -228,6 +224,14 @@ const componentOptions = {
}
}
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
();
},
handleSwipeChange
(
e
)
{
this
.
setData
({
currentSwiperIndex
:
e
.
detail
.
current
})
...
...
static/nativeComponents/GoodsList/index.wxml
View file @
8576c3d2
...
...
@@ -150,11 +150,11 @@
<heap-item datas="{{datas}}"></heap-item>
</view>
<!-- 轮播滑动 -->
<view wx:if="{{datas.componentData.style === 'swipe'}}" style="position:relative;">
<swiper bindchange="handleSwipeChange" style="height: {{swiper
TypeHeightList[datas.componentData.columnNum]}}
">
<view wx:if="{{datas.componentData.style === 'swipe'
&& datas.componentData.goodsList.length > 0
}}" style="position:relative;">
<swiper bindchange="handleSwipeChange" style="height: {{swiper
Height}}px
">
<block wx:for="{{swipeInfo}}">
<swiper-item>
<view 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">
<goods-item
datas="{{datas}}"
...
...
@@ -166,7 +166,7 @@
</swiper-item>
</block>
</swiper>
<view class="flex custom-indicator">
<view class="flex custom-indicator"
wx:if="{{swiperHeight > 0}}"
>
<block wx:for="{{swipeInfo}}">
<view class="custom-indicator__item {{currentSwiperIndex === index && 'custom-indicator__active'}}"></view>
</block>
...
...
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