小程序宿主环境-组件swiper

巧识小程序的开发过程学习.


在我们的list.wxml中创建组件

html 复制代码
<swiper class="swiper-container" indicator-dots indicator-color="white" indicator-active-color="grey" autoplay interval="2000" circular>
  <!--第一个轮播图-->
  <swiper-item>
    <view class="item">A</view>
  </swiper-item>
  <!--第二个轮播图-->
  <swiper-item>
    <view class="item">B</view>
  </swiper-item>
  <!--第三个轮播图-->
  <swiper-item>
    <view class="item">C</view>
  </swiper-item>
</swiper>

在我们list.wxss创建样式

css 复制代码
/* pages/list/list.wxss */
.swiper-container{
height: 150px;
}
.item{
height: 100%;
line-height: 150px;
text-align: center;
}
swiper-item:nth-child(1){
background-color: sandybrown;
}
swiper-item:nth-child(2){
  background-color: rgb(106, 111, 158);
}
swiper-item:nth-child(3){
  background-color: rgb(136, 41, 48);
  }

效果实现轮播图

swiper组件的常用属性

属性indicator-dots:是否显示面板指示点

属性indicator-color:指示点颜色

属性indicator-active-color:指示点激活颜色

属性autoplay:是否自动切换

属性interval:自动切换的时间默认5s

属性circular:是否循环轮播

相关推荐
说私域10 分钟前
社群时代下的商业变革:“开源AI智能名片链动2+1模式S2B2C商城小程序”的应用与影响
人工智能·小程序·开源
毕设源码-朱学姐2 小时前
【开题答辩全过程】以 基于Java的医务室病历管理小程序为例,包含答辩的问题和答案
java·开发语言·小程序
文人sec3 小时前
微信小程序minium自动化测试SOP
微信小程序·小程序
克里斯蒂亚诺更新3 小时前
微信小程序 点击地图后弹出一个模态框
微信小程序·小程序·notepad++
云起SAAS3 小时前
患者随访管理抖音快手微信小程序看广告流量主开源
微信小程序·小程序·ai编程·看广告变现轻·患者随访管理
2501_916008893 小时前
HTTPS 请求抓包,从原理到落地排查的工程化指南(Charles / tcpdump / Wireshark / Sniffmaster)
ios·小程序·https·uni-app·wireshark·iphone·tcpdump
金梦人生3 小时前
UniApp + Vue3 + TS 工程化实战笔记
前端·微信小程序
2501_9159090616 小时前
WebView 调试工具全解析,解决“看不见的移动端问题”
android·ios·小程序·https·uni-app·iphone·webview
说私域17 小时前
“开源链动2+1模式AI智能名片S2B2C商城小程序”在拉群营销中的应用与效果
人工智能·小程序
2501_9151063218 小时前
App 怎么上架 iOS?从准备资料到开心上架(Appuploader)免 Mac 上传的完整实战流程指南
android·macos·ios·小程序·uni-app·iphone·webview