微信小程序switch 样式重写

一、switch开关组件,在小程序中有固定的样式和大小

如果想自定义样式的话需要重写,重写样式如下:

.wx-switch-input {}
.wx-switch-input::before {}
.wx-switch-input::after {}

二、重写示例如下:

注意:border、box-shadow样式的重置,不然会视觉上有偏差

/******************switch效果********************/
.wx-switch-input {
  width: 35px !important;
  height: 18px !important;
  box-sizing: border-box;
  position: relative;
  border: 0px !important;
}

.wx-switch-input::before {
  width: 35px !important;
  height: 18px !important;
  background: #CCCCCC !important;
  border: 0px solid #CCCCCC !important;
  box-shadow: none !important;
  left: 0px;
  top: 0px;
}

.wx-switch-input::after {
  width: 16px !important;
  height: 16px !important;
  top: 1px !important;
  left: 0px !important;
  opacity: 1 !important;
  box-sizing: border-box;
  box-shadow: none !important;
  border: 0px !important;
}

更多:

 小程序Image组件长按识别支持的码

C# 中的可用类型_不可用类型_C#双问号_C#问号点_C# null不等于

C# 10新增功能_C# 10新增特性

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值