constructor() {
super(...arguments)
this.state = {
selected: 0
}
}
handleSelectBtn() {
let mark = !this.state.selected
this.setState(() => {
return {
selected: mark
};
});
}
<View
onClick={this.handleSelectBtn}
className={`radio ${this.state.selected ? "active" : null}`}
></View>
.radio {
width: 32px;
height: 32px;
border-radius: 50%;
overflow: hidden;
background: white;
border: 2px solid rgba(3, 118, 232, 1); &.active:after {
content: '✔';
font-size: 24px;
color: rgba(3, 118, 232, 1);
display: flex;
justify-content: center;
align-content: center;
line-height: 34px;
}
}