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
33ef3c40
Commit
33ef3c40
authored
Feb 04, 2021
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
轮播图优化
parent
4a204ee7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
25 deletions
+62
-25
src/pages/home/index.vue
+1
-1
static/nativeComponents/Banner/index.js
+22
-7
static/nativeComponents/Banner/index.wxml
+24
-7
static/nativeComponents/Banner/index.wxss
+15
-10
No files found.
src/pages/home/index.vue
View file @
33ef3c40
...
...
@@ -203,7 +203,7 @@ export default {
console
.
log
(
"36"
,
this
.
pageData
);
},
scrolls
(
el
){
if
(
this
.
$mp
.
page
.
selectComponent
(
".goodsListItem"
)){
if
(
this
.
$mp
.
page
&&
this
.
$mp
.
page
.
selectComponent
(
".goodsListItem"
)){
this
.
$mp
.
page
.
selectComponent
(
".goodsListItem"
).
getScroll
(
el
);
}
},
...
...
static/nativeComponents/Banner/index.js
View file @
33ef3c40
...
...
@@ -21,20 +21,34 @@ Component({
autoplay
:
false
,
interval
:
2000
,
duration
:
500
,
activeIndex
:
0
,
activeIndex
:
0
,
bannerHeight
:
0
,
firstLoad
:
false
,
},
methods
:
{
customMethod
()
{
console
.
log
(
"hello world! I am learning 微信小程序"
);
},
bannerChange
(
val
)
{
console
.
log
(
val
,
'--------30'
)
this
.
setData
({
activeIndex
:
val
.
detail
.
current
});
console
.
log
(
val
,
"--------30"
);
this
.
setData
({
activeIndex
:
val
.
detail
.
current
});
},
onClick
(
data
){
let
item
=
data
.
currentTarget
.
dataset
.
item
;
console
.
log
(
data
.
currentTarget
.
dataset
.
item
,
'iiii'
)
app
.
$themeToLink
(
item
.
link
)
onClick
(
data
)
{
let
item
=
data
.
currentTarget
.
dataset
.
item
;
console
.
log
(
data
.
currentTarget
.
dataset
.
item
,
"iiii"
);
app
.
$themeToLink
(
item
.
link
);
},
loadImg
(
e
)
{
let
{
firstLoad
}
=
this
.
data
;
if
(
firstLoad
==
true
)
{
return
;
}
firstLoad
=
true
;
let
winWid
=
wx
.
getSystemInfoSync
().
windowWidth
;
//获取当前屏幕的宽度
let
imgh
=
e
.
detail
.
height
;
//图片高度
let
imgw
=
e
.
detail
.
width
;
let
swiperH
=
winWid
*
imgh
/
imgw
+
"px"
;
this
.
setData
({
bannerHeight
:
swiperH
,
firstLoad
});
//设置高度
}
}
});
\ No newline at end of file
static/nativeComponents/Banner/index.wxml
View file @
33ef3c40
<view>
<view class="banner"
style="--dotsColor:{{datas.componentData.indColor}};padding-top:{{datas.componentData.paddingList[0].value*2}}rpx;padding-bottom:{{datas.componentData.paddingList[1].value*2}}rpx;padding-left:{{datas.componentData.paddingList[2].value*2}}rpx;padding-right:{{datas.componentData.paddingList[3].value*2}}rpx;">
<view class="banner" style="--dotsColor:{{datas.componentData.indColor}};padding-top:{{datas.componentData.paddingList[0].value*2}}rpx;padding-bottom:{{datas.componentData.paddingList[1].value*2}}rpx;padding-left:{{datas.componentData.paddingList[2].value*2}}rpx;padding-right:{{datas.componentData.paddingList[3].value*2}}rpx;">
<view class="bannerItem">
<swiper class="swiper" indicator-dots="{{indicatorDots}}"
autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" circular="true" bindchange="bannerChange">
<swiper
class="swiper {{datas.componentData.initIndSite=='onter'?'onterDot':''}}"
indicator-dots="{{indicatorDots}}"
autoplay="{{autoplay}}"
interval="{{interval}}"
duration="{{duration}}"
circular="true"
bindchange="bannerChange"
style="height:{{bannerHeight}}"
>
<block wx:for="{{datas.componentData.imgList}}" wx:key="index">
<swiper-item data-item="{{item}}" bindtap="onClick"
>
<swiper-item data-item="{{item}}" bindtap="onClick"
>
<view class="swiper-item">
<image src="{{item.imageUrl}}" style="width:100%;border-radius:{{datas.componentData.borderRadius*2}}rpx" mode="widthFix" class="bannerImgItem"></image>
<image
src="{{item.imageUrl}}"
style="width:100%;border-radius:{{datas.componentData.borderRadius*2}}rpx"
mode="widthFix"
bindload="loadImg"
class="bannerImgItem"
></image>
</view>
</swiper-item>
</block>
</swiper>
<view class="dots">
<view class="dotsItem {{index==activeIndex?'isDotsColor':''}} {{datas.componentData.indStyle == 'flat'?'dotsStyle1':'dotsStyle2'}}" wx:for="{{datas.componentData.imgList}}" wx:key="index"></view>
<view
class="dotsItem {{index==activeIndex?'isDotsColor':''}} {{datas.componentData.indStyle == 'flat'?'dotsStyle1':'dotsStyle2'}} {{datas.componentData.indBorderShow==true?'dotBorder':''}}"
wx:for="{{datas.componentData.imgList}}"
wx:key="index"
></view>
</view>
</view>
</view>
...
...
static/nativeComponents/Banner/index.wxss
View file @
33ef3c40
...
...
@@ -6,7 +6,9 @@
}
.swiper{
width: 100%;
height: calc(100vw*9/16);
/* height: calc(100vw*9/16); */
}
.onterDot{
padding-bottom: 32rpx;
}
.swiper-item{
...
...
@@ -38,18 +40,21 @@
margin: 0 8rpx;
background: rgba(255,255,255,0.4);
}
.dotBorder{
border: 1px solid var(--dotsColor);
}
.dotsStyle1{
width: 3
0
rpx;
height: 1
0
rpx;
border-radius:
4
rpx;
-webkit-border-radius:
4
rpx;
-moz-border-radius:
4
rpx;
-ms-border-radius:
4
rpx;
-o-border-radius:
4
rpx;
width: 3
6
rpx;
height: 1
2
rpx;
border-radius:
12
rpx;
-webkit-border-radius:
12
rpx;
-moz-border-radius:
12
rpx;
-ms-border-radius:
12
rpx;
-o-border-radius:
12
rpx;
}
.dotsStyle2{
width:
20
rpx;
height:
20
rpx;
width:
16
rpx;
height:
16
rpx;
border-radius: 50%;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
...
...
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