自定义微信小程序swiper轮播图面板指示点的样式

微信小程序的swiper组件是滑块视图容器,也就是说平常我们看到的轮播图就可以用它来做,不过这个组件有很多样式是固定的,但是,有时候我们的设计稿的面板指示点是需要个性化的,那么如何去修改swiper组件的面板指示点的样式呢?最近在使用swiper的时候也在想这个,最后发现在调试的时候,可以看到他的选择器。如图:


1

2

3

4

5

6

7

8

9

<swiper class="swiper-box" indicator-dots="{{ indicatordots }}" autoplay="{{ autoplay }}">

    <block wx:for="{{ swiperItem }}">

        <swiper-item>

            <navigator url="{{ item.linkUrl }}">

                <image class="slide-image" src="{{ item.imgUrl }}"></image>

            </navigator>

        </swiper-item>

    </block>

</swiper>


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

.swiper-box .wx-swiper-dots.wx-swiper-dots-horizontal{

     margin-bottom2rpx;

}

.swiper-box .wx-swiper-dot{

    width:40rpx;

    display: inline-flex;

    height10rpx;

    margin-left20rpx;

    justify-content:space-between;

}

.swiper-box .wx-swiper-dot::before{

    content‘‘;

    flex-grow: 1

    background: rgba(255,255,255,0.8);

    border-radius: 8rpx

}

.swiper-box .wx-swiper-dot-active::before{

    background:rgba(244,0,0,0.8);   

}

  

虽然可以通过上面的代码修改swiper面板指示点的样式,但是还是有局限性的,不过总算可以修改了,在此简单记录一下。。 

.

原文地址:https://www.cnblogs.com/jianxian/p/11215450.html

时间: 2024-08-03 07:48:49

自定义微信小程序swiper轮播图面板指示点的样式的相关文章

如何自定义微信小程序swiper轮播图面板指示点的样式

https://www.cnblogs.com/myboogle/p/6278163.html 微信小程序的swiper组件是滑块视图容器,也就是说平常我们看到的轮播图就可以用它来做,不过这个组件有很多样式是固定的,但是,有时候我们的设计稿的面板指示点是需要个性化的,那么如何去修改swiper组件的面板指示点的样式呢?最近在使用swiper的时候也在想这个,最后发现在调试的时候,可以看到他的选择器.如图: <swiper class="swiper-box" indicator-

微信小程序的轮播图swiper问题

微信小程序的轮播图swiper,调用后,怎样覆盖系统的 点,达到自己想要的效果 不多说,先上一图望大家多给意见: 这个是效果图: 微信小程序效果图就成这样子: <view class="section section_gap swiper"> <swiper indicator-dots="{{indicatorDots}}" vertical="{{vertical}}" autoplay="{{autoplay}}

小程序--swiper轮播图组件

效果图展示: 先了解下swiper组件参数配置 轮播实现的具体步骤如下: 第一步:添加图片素材,我这边是放到images下,文件以及图片名字自定义即可. 第二步:在wxml中进行页面布局 在这里呢,用到了列表渲染.swiper组件,三元运算符(注:由于小程序不能操作dom,三元运算符还有一个常用的使用场景是控件class样式输出,达到jQuery.addClass()的效果) <view class="swiper-container"> <swiper autopl

微信小程序之轮播图

今天记录一下微信小程序开发时,轮播图的效果时怎么实现的.话不多说,直接上代码: <!-- 1. 首页轮播图 --> <view> <swiper class="my-swiper" autoplay="true" indicator-dots="true" indicator-active-color="#fff" circular="true"> <block w

小程序切换轮播图显示空白的问题

技术栈,taro编译的小程序,场景: 首页几个tab切换,默认第一个tab轮播图有数据,切换的时候后面的轮播图有的时候显示空白,请看: 首先父组件到子组件的值传过来了,自组件img src路径也有值,复制出来地址浏览器,显示没问题,路径问题排除 第一个tab三张轮播图,第二个两张轮播图,其他的tab都是一张,每个tab都从 数组形式传值过来的.有数据这是怎么回事,于是翻翻小郑许官网看到这 https://developers.weixin.qq.com/miniprogram/dev/compo

小程序之轮播图(2020.4.13更新)

wxml <!-- 轮播图 --> <view class='carousel'> <swiper class='carousel_swiper' indicator-dots="true" indicator-color="#f4f4f4" indicator-active-color="#4eb8b8" autoplay="true" interval='5000' circular='tru

小程序-广告轮播/控制属性

[转]小程序-广告轮播/控制属性 微信小程序广告轮播元素<swiper></swiper>  图片所在元素<swiper-item>/swiper-item> 其中属性有: autoplay:true,//是否自动播放 autoplaytxt:"停止自动播放", indicatorDots: true,//指示点 // indicator-color:"white",//指示点颜色 暂未启动 // indicator-act

3. vue中导入animate.css动画库、Swiper轮播图组件

1. vue中导入animate.css动画库 2. vue中使用Swiper轮播图插件 注意:swiper常用设置 原文地址:https://www.cnblogs.com/qfshini/p/12120612.html

绑定bindchange事件的微信小程序swiper闪烁,抖动问题解决,(将微信小程序切换到后台一段时间,再打开微信小程序,会出现疯狂循环轮播,造成抖动现象)

微信小程序开发文档-组件-swiper后面追加的新闻如上图所示: 如果在bindchange事件给swiper的current属性对应的值{{current}}赋值,就会造成抖动现象. 1 bindchangeSwiper(event) { 2 console.log(event.detail); 3 this.setData({ 4 current: event.detail.current 5 }) 6 }, 可是有的时候我们确实需要动态获取当前的swiper-item索引,用来额外做一些其