本方案解决微信小程序幻灯的swiper标签宽和高度自适应方案,费话少说直接上代码:
.wxhl中的代码:
<swiper indicator-dots='true' indicator-color='rgba(0,0,0,0.3)' indicator-active-color='#04997C' autoplay='true' interval='5000' class='banner' style='height:{
{bannerHeight}}px'>
<block wx:for="{
{imgUrls}}">
<swiper-item>
<image src="{
{item}}" class="slide-image" mode='{
{mod[1]}}' bindload='imageLoad'></image>
</swiper-item>
</block>
</swiper>
css代码:
.banner{ width: 100%; height: auto; display: block;}
.slide-image{ width: 100%; display: block;}
js代码:
data: {
i