首页>>帮助中心>>美国服务器swiper组件实现图片轮播切换功能

美国服务器swiper组件实现图片轮播切换功能

2025/2/10 72次
美国服务器使用swiper组件实现图片轮播切换显示功能,涉及swiper组件相关属性使用技巧,希望能帮助到大家。

关键代码

index.wxml:

<swiper indicator-dots="true"autoplay="true" interval="3000" duration="600" style="height:300px;">
<swiper-item>
<image src="../../pages/images/img1.png" style="display: block;height: 300px;"/>
</swiper-item>
<swiper-item>
<image src="../../pages/images/img2.png" style="display: block;height: 300px;"/>
</swiper-item>
<swiper-item>
<image src="../../pages/images/img3.png" style="display: block;height: 300px;"/>
</swiper-item>
</swiper>
swiper组件属性说明如下:



属性名 类型 默认值 说明 最低版本
indicator-dots Boolean false 是否显示面板指示点
indicator-color Color rgba(0, 0, 0, .3) 指示点颜色 1.1.0
indicator-active-color Color #000000 当前选中的指示点颜色 1.1.0
autoplay Boolean false 是否自动切换
current Number 0 当前所在页面的 index
interval Number 5000 自动切换时间间隔
duration Number 500 滑动动画时长
circular Boolean false 是否采用衔接滑动
vertical Boolean false 滑动方向是否为纵向
bindchange EventHandle
current 改变时会触发 change 事件,event.detail = {current: current, source: source}

购买使用一诺网络美国服务器,可以极大降低初创企业、中小企业以及个人开发者等用户群体的整体IT使用成本,无需亲自搭建基础设施、简化了运维和管理的日常工作量,使用户能够更专注于自身的业务发展和创新。美国服务器低至49元/月,购买链接:https://www.enuoidc.com/vpszq.html?typeid=3