小程序修改默认单、多选框样式

文中单选框和多选框状态默认为选中状态

单选框默认样式修改

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
.coupon-radio radio {
display: block;
}

.coupon-radio radio .wx-radio-input {
display: block;
border-color: #d8d8d8 !important;
}

.coupon-radio radio .wx-radio-input.wx-radio-input-checked {
display: block;

background: transparent !important;
}

.coupon-radio radio .wx-radio-input.wx-radio-input-checked::before {
display: block;
width: 42rpx;
height: 42rpx;
font-size: 0;
background: #9b9b9b !important;
border-radius: 100%;
}

如下图:单选框样式修改

多选框默认样式修改

样式一

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
.user-protocol-box checkbox {
display: block;
width: 32rpx;
height: 32rpx;
margin-right: 14rpx;
}

.user-protocol-box checkbox .wx-checkbox-input {
border-radius: 6rpx;
width: 32rpx;
height: 32rpx;
background: #d0021b;
line-height: 1;
border: none;
}

checkbox .wx-checkbox-input:before {
color: #fff;
}

如下图:多选框样式一修改

样式二

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
.user-protocol-box{
font-size: 26rpx;
color: #8d8d8d;
text-align: left;
}

.user-protocol-box checkbox {
display: block;
width: 30rpx;
height: 39rpx;
line-height: 1;
margin-right: 24rpx;
}

/* 未选中状态 */
.user-protocol-box checkbox .wx-checkbox-input {
display: block;
width: 30rpx;
height: 30rpx;
line-height: 1;
border: 1rpx solid #d5d5d5;
background: #404040;
}

/* 选中状态 */
.user-protocol-box checkbox .wx-checkbox-input-checked::before {
display: block;
left: 14rpx;
top: 14rpx;
border: none !important;
font-size: 48rpx;
border-radius: 6rpx;
color: #303030;
background: #d5d5d5;
}

.user-protocol {
margin-left: 10rpx;
}

如下图:多选框样式二修改

-----本文结束感谢您的阅读-----