0
点赞
收藏
分享

微信扫一扫

微信小程序checkbox样式美化

金刚豆 2022-03-12 阅读 72

微信小程序checkbox默认默认样式显得非常不美观,需对其进行样式美化,
在这里插入图片描述

样式美化后的结果:
在这里插入图片描述
代码如下:
html:

 <checkbox-group data-id="{{item.goods_id}}" bindchange="handleItemCheck">
     <checkbox checked="{{item.checked}}"></checkbox>
 </checkbox-group>

css:

checkbox .wx-checkbox-input {
	width: 34rpx;
	height: 34rpx;
	border-radius: 50%;
}
/*checkbox选中后样式  */
checkbox .wx-checkbox-input.wx-checkbox-input-checked {
  background: #DB2618;
  border-color:#DB2618;
}
/*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);
}
举报

相关推荐

0 条评论