小程序修改复选框样式

/* 未选中的 背景样式 */

checkbox .wx-checkbox-input{
    
    
    border-radius: 50%; /* 圆角 */
    width: 40rpx; /* 背景的宽 */
    height: 40rpx; /* 背景的高 */
}

/* 选中后的 背景样式 (红色背景 无边框 可根据UI需求自己修改) */

checkbox .wx-checkbox-input.wx-checkbox-input-checked{
    
    
    border: 1rpx solid #1d2088;
    background: #1d2088;
}

/* 选中后的√勾样式 (白色对勾 可根据UI需求自己修改) */

checkbox .wx-checkbox-input.wx-checkbox-input-checked::before{
    
    
    font-size:30rpx; /* 选中后√的大小*/
    color:#ffffff; /* 选中后√的颜色 */
    background: transparent;
}

注意:必须将scoped去掉不然不生效

<style lang="less" scoped>

</style>

猜你喜欢

转载自blog.csdn.net/liaoweilin0529/article/details/129490727