小程序switch 按钮的样式改变

.wxml代码                                                   默认样式 修改后样式

<switch bindchange="switch2Change" class="switch"/>

.wxss代码

    .wx-switch-input{
    /* 按钮的背景大小*/
    width: 80rpx !important;
    height: 40rpx !important;
    background: #0C2648 !important;
    border: #0C2648 !important;   
    }
    
    /*白色样式(false的样式)*/
    .wx-switch-input::before{
    /* 按钮的背景大小  */
    width: 80rpx !important;   
    height: 40rpx !important;    
    /* Switch的阴影效果 */
    box-shadow: 0px 2px 14px 0px rgba(0, 0, 0, 0.5);
  
    }
    /* 中间的小圆球 */ 
    /*绿色样式(true的样式)*/
    .wx-switch-input::after{  
    width: 40rpx !important;
    height: 40rpx !important;
    
    }

 

posted on 2022-03-15 15:36  隔壁老王(加速版)  阅读(406)  评论(0)    收藏  举报