百度小程序swiper爬坑 解决不了自适应

本文介绍了一个轮播图组件的配置与使用方法,详细解释了如何通过修改组件属性实现图片轮播效果,包括自动播放、切换指示器、图片间隔时间等设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

.swan

 <swiper 
            indicator-color="rgba(0,0,0,0.30)"
            indicator-active-color="#fff"
            duration="{{switchDuration}}"
            interval="{{autoPlayInterval}}"
            autoplay="{{switchAutoPlayStatus}}"
            indicator-dots="{{switchIndicateStatus}}" 
            vertical="false"
            circular="true"
            current="0"
            current-item-id="0"
            previous-margin="0px"
            next-margin="0px"
            display-multiple-items="1"
            bind:change="swiperChange"
            bind:animationfinish="animationfinish"
        >        
                    <view s-for="i in imgUrls" class="">
                            <view s-for="d in i" class="novel_block">
                                        <view class="novel_block">
                                            <image class="image"
                                                data-name="aspectFill"
                                                bindtap="onTap"
                                                mode="" src="{{d.img}}" binderror="imageError" bindload="imageLoad" />
                                            <view class="novel_name">{{d.title}}</view> 
                            </view>
                    </view>
                
        </swiper>

.js

Page({
    data: {
        imgUrls: [
            [{title:'蒙牛上天',img:'../../images/1.jpg',url:'/test/index'},
            {title:'蒙牛上天',img:'../../images/1.jpg'},
            {title:'蒙牛上天',img:'../../images/1.jpg'}],
            [{title:'蒙牛上天',img:'../../images/2.jpg'},
            {title:'蒙牛上天',img:'../../images/2.jpg'},
            {title:'蒙牛上天',img:'../../images/2.jpg'}],
            [{title:'蒙牛上天',img:'../../images/3.jpg'},
            {title:'蒙牛上天',img:'../../images/3.jpg'},
            {title:'蒙牛上天',img:'../../images/3.jpg'}]
        ],
        current: 0,
        switchIndicateStatus: true,
        switchAutoPlayStatus: true,
        switchDuration: 800,
        autoPlayInterval: 2000
    },

});

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值