小程序宿主环境-组件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:是否循环轮播

相关推荐
咖啡の猫20 小时前
微信小程序页面事件
微信小程序·小程序·notepad++
咖啡の猫21 小时前
微信小程序网络数据请求
网络·微信小程序·小程序
object not found1 天前
基于uniapp开发小程序自定义顶部导航栏状态栏标题栏
前端·javascript·小程序·uni-app
咖啡の猫1 天前
微信小程序案例 - 本地生活(列表页面)
微信小程序·生活·notepad++
咖啡の猫1 天前
微信小程序案例 - 本地生活(首页)
微信小程序·生活·notepad++
咸虾米_1 天前
uniapp引入iconfont字体图标在微信小程序中适用
微信小程序·小程序·uni-app
咖啡の猫1 天前
微信小程序页面导航
微信小程序·小程序
小咕聊编程1 天前
【含文档+PPT+源码】基于微信小程序的点餐系统的设计与实现
微信小程序·小程序
2501_915918412 天前
如何在iPad上找到并打开文件夹的完整指南
android·ios·小程序·uni-app·iphone·webview·ipad
shejizuopin2 天前
基于Spring Boot+小程序的非遗科普平台设计与实现(毕业论文)
spring boot·后端·小程序·毕业设计·论文·毕业论文·非遗科普平台设计与实现