前端使用input 来写radio,小程序使用radio标签 也可以使用
1.自定义radio样式、
wx默认的是真的丑
radio .wx-radio-input{
width: 32rpx;
height: 32rpx;
border-radius: 0
}
radio .wx-radio-input.wx-radio-input-checked{
width: 32rpx;
height: 32rpx;
background:white!important;
}
radio .wx-radio-input.wx-radio-input-checked::before{
width: 32rpx;
height: 32rpx;
line-height: 32rpx;
text-align: center;
font-size:36rpx;
color:black;
background: white;
transform:translate(-50%, -50%) scale(1);
-webkit-transform:translate(-50%, -50%) scale(1);
}
2.单选打勾再选打勾取消效果
wxml:
wx.js
//这条代码在data里写
check:false
radiocon:function(e){
this.setData({
check: !this.data.check
})
console.log("用户打勾的是 ",this.data.check)
},
这样 就完成了单击打勾再击取消。
以上。



