小程序宿主环境-组件swiper

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


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

<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创建样式

/* 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:是否循环轮播

相关推荐

  1. 程序宿主环境-组件image

    2024-01-20 06:40:01       27 阅读
  2. 初识微信程序swiperswiper-item的基本使用

    2024-01-20 06:40:01       8 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-01-20 06:40:01       19 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-20 06:40:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-20 06:40:01       20 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-20 06:40:01       20 阅读

热门阅读

  1. 前端vue2生成二维码并可保存

    2024-01-20 06:40:01       34 阅读
  2. docker 的 Dockerfile 简单使用

    2024-01-20 06:40:01       37 阅读
  3. 学习搭建Vue组件库

    2024-01-20 06:40:01       35 阅读
  4. GitHub 上如何提出 issue?

    2024-01-20 06:40:01       29 阅读
  5. 爬虫系列实战:使用json解析天气数据

    2024-01-20 06:40:01       30 阅读
  6. Note of CLEAN CODE chapter 2 - Meaningful Name

    2024-01-20 06:40:01       25 阅读
  7. uniapp echarts x轴 支持html标签

    2024-01-20 06:40:01       29 阅读