微信小程序修改radio和checkbox选中颜色

可以根据自己需求改动

wxss:

.checkType {
    /* height: 100rpx;
    line-height: 100rpx; */
    display: flex;
    width: 90%;
    margin: 0 5%;
    flex-direction: column;
}

.checkType-item {
    /* width: 50%; */
    display: flex;
    justify-content: center;
    flex-direction: column;
}

.RADIO {
    height: 100rpx;
    line-height: 100rpx;
    display: flex;
    width: 90%;
    margin: 0 5%;
    justify-content: space-around;
    border-bottom: 1px solid #F0F0F0;
}


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

radio .wx-radio-input.wx-radio-input-checked {
    border-color: #1677FF !important;
    background-color: #1677FF !important;
}

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

checkbox .wx-checkbox-input.wx-checkbox-input-checked {
    border-color: #1677FF !important;
    background-color: #1677FF !important;
}

wxml:

 <radio-group bindchange="radioChange" class="RADIO" data-type="{{vo.id}}" data-code="{{vo.answerCode}}">
                                                    <label style="width: 50%;display: flex;justify-content: center;" wx:for="{{vo.answers}}" wx:key="item">
                                                        <view class="weui-cell__hd">
                                                            <radio value="{{item.id}}" checked="{{item.checked}}" wx:if="{{options.sheetid}}" />
                                                            <radio value="{{item.id}}" wx:else />
                                                        </view>
                                                        <view class="weui-cell__bd">{{item.answerValue}}</view>
                                                    </label>
                                                </radio-group>
 <checkbox-group bindchange="checkboxChange" class="checkType" data-id="{{index}}" data-pId="{{vo.id}}" data-dictValueCode="{{vo.dictValueCode}}">
                            <label class="checkType-item" wx:for="{{vo.answers}}" wx:key="item" wx:for-index="index">
                                <view style="display: flex;height: 100rpx;line-height: 100rpx;">
                                    <checkbox value="{{item.id}}" checked="{{item.checked}}" style="color:#3A6AFA;" />
                                    <view class="weui-cell__bd">{{item.answerValue}}</view>
                                </view>
  </label>
                        </checkbox-group>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值