修改开关选择器switch的样式
微信小程序官方文档:https://developers.weixin.qq.com/miniprogram/dev/component/switch.html
1.一个开关
checked=”true” 为选中状态
<switch name="switch" checked="true" />
默认样式如图
2.修改选中状态样式
.wx-switch-input {
width: 70rpx !important;
height: 40rpx !important;
background: #97c9c6 !important;
border: 0rpx solid #97c9c6 !important;
}
选中状态下的样式如图 点击关闭之后的样式
修改选中状态下小圆点的样式
.wx-switch-input::after {
width: 40rpx !important;
height: 40rpx !important;
}
如图:
4.关闭状态的样式
.wx-switch-input::before {
width: 70rpx !important;
height: 40rpx !important;
background: #ddd !important;
border: 0rpx solid #ddd !important;
}
效果如图:
还没有评论,来说两句吧...