微信小程序轮播图1

<!-- 轮播图 -->
<swiper circular indicator-dots indicator-color="#cccccc" indicator-active-color="#ff0000" autoplay="true" interval="5000" duration="500">
  <block wx:for="{{swiperImg}}" wx:key="index">
    <swiper-item>
      <image src="{{item.src}}" class="silde-image"></image>
    </swiper-item>
  </block>
</swiper>
<!-- 笔记
1.轮播图外层容器  <swiper></swiper>
2.每一个轮播图项 <swiper-item></swiper-item>
3.<swiper></swiper>标签存在默认样式
  1.width:100%
  2.height:150px;    <image></image>标签存在默认宽度和高度320*24
  3.<swiper></swiper>高度无法实现由内容撑开
4.先找出来原图和高度等比例给swiper定高度和宽度
  假如原图的宽度和高度为:1125*325px
  swiper宽度 / swiper高度 = 原图的宽度 / 原图的高度
  swiper 高度 = swiper宽度  * 原图高度 / 原图宽度
  height:100vm * 352 / 1125
  如css样式:
  swiper{
    width:100%;
    height:cacl(100vm * 352 / 1125);
  }
  image{
    width:100%;
  }
5.autoplay="true" 自动轮播
6.interval="5000" 修改轮播时间
7.circular 衔接轮播
8.indicator-dots 显示指示器,分页器,索引器
9.indicator-color="#cccccc" 指示器的未选择的颜色
10.indicator-active-color="#ff0000"  选中的时候指示器的颜色-->

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值