效果图如下所示:
html部分代码如下:
<label class="checkbox checkwords" wx:for="{{items}}">
<checkbox value="{{item.name}}" checked="{{item.checked}}"/>{{item.value}}
</label>
css部分代码如下:
/*checkbox 选项框大小 */
checkbox .wx-checkbox-input {
width: 36rpx;
height: 36rpx;
border-radius: 50%;
border-color: #2ea7e0;
vertical-align: middle;
}
/*checkbox选中后样式 */
checkbox .wx-checkbox-input.wx-checkbox-input-checked {
background:#2ea7e0;
}
/*checkbox选中后图标样式 */
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
width: 30rpx;
height: 30rpx;
line-height: 28rpx;
text-align: center;
font-size: 22rpx;
color: #ffffff;
background: transparent;
transform: translate(-50%, -50%) scale(1);
-webkit-transform: translate(-50%, -50%) scale(1);
}
js部分代码如下:
items: [
{ name: '1111', value: '选中', checked: 'true' },
],
拓展:
/* 去除复选框 */
checkbox .wx-checkbox-input {
display: none;
}