微信小程序中修改checkbox的样式

效果图 效果图

1,wxml 代码

<checkbox-group>
    <label>
        <checkbox></checkbox>   
    </label>
</checkbox-group>

2,wxss 代码

checkbox .wx-checkbox-input {
    width: 34rpx;
    height: 34rpx;
    border-radius: 50%;
}
/*checkbox选中后样式  */
checkbox .wx-checkbox-input.wx-checkbox-input-checked {
  background: #0394F0;
  border-color:#0394F0;
}
/*checkbox选中后图标样式  */
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
  width: 20rpx;
  height: 20rpx;  
  line-height: 20rpx;
  text-align: center;
  font-size: 22rpx;
  color: #fff;
  background: transparent;
  transform: translate(-50%, -50%) scale(1);
  -webkit-transform: translate(-50%, -50%) scale(1);
}

猜你喜欢

转载自www.cnblogs.com/anyw3c/p/11596778.html