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

在这里插入图片描述

<view class="container">
  <view class="checkbox1">
    默认多选
    <label>
      <checkbox value="c1" checked="true" />选中
    </label>
    <label>
      <checkbox value="c1" />未选中
    </label>
  </view>
  <view class="checkbox2">
    修改多选
    <label>
      <checkbox value="c2" checked="true" />选中
    </label>
    <label>
      <checkbox value="c2" />未选中
    </label>
  </view>

  <view class="radio1">
    <radio-group bindchange="radioChange">
      默认单选
      <label wx:for="{{items}}" wx:key="{{item.value}}">
        <radio value="{{item.value}}" checked="true" />
        {{item.name}}
      </label>
    </radio-group>
  </view>
  <view class="radio2">
    <radio-group bindchange="radioChange">
      修改单选
      <label wx:for="{{items}}" wx:key="{{item.value}}">
        <radio value="{{item.value}}" checked="true" />
        {{item.name}}
      </label>
    </radio-group>
  </view>
</view>
.container {
  padding: 30px;
}

view {
  margin-bottom: 50rpx;
}

/* checkbox */
.checkbox2 checkbox .wx-checkbox-input {
  width: 45rpx;
  height: 45rpx;
}

.checkbox2 checkbox .wx-checkbox-input.wx-checkbox-input-checked {
  border-color: #FF525C;
  background: #FF525C;
}

.checkbox2 checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
  width: 30rpx;
  height: 30rpx;
  line-height: 30rpx;
  text-align: center;
  font-size: 26rpx;
  color: #fff;
  background: transparent;
  transform: translate(-50%, -50%) scale(1);
  -webkit-transform: translate(-50%, -50%) scale(1);
}

/* radio */
.radio2 radio .wx-radio-input {
  height: 45rpx;
  width: 45rpx;
  margin-top: -4rpx;
  border-radius: 4rpx;
  border: 2rpx solid #ccc;
  background-color: #fff;
}

.radio2 radio .wx-radio-input.wx-radio-input-checked {
  border: 2rpx solid #ccc;
  background: #fff;
}

.radio2 radio .wx-radio-input.wx-radio-input-checked::before {
  width: 47rpx;
  height: 47rpx;
  line-height: 47rpx;
  text-align: center;
  font-size: 36rpx;
  color: #ff525c;
  background: #fff;
  border: 2rpx solid #ccc;
  border-radius: 4rpx;
  transform: translate(-50%, -50%) scale(1);
  -webkit-transform: translate(-50%, -50%) scale(1);
}
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值