jsx选择取消按钮

 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;
        }
      }
全部评论

相关推荐

认真搞学习:这么良心的老板真少见
点赞 评论 收藏
分享
Yki_:你要算时间成本呀,研究生两三年,博士三四年,加起来就五六年了,如果你本科去腾讯干五年,多领五年的年薪,加上公司内涨薪,可能到时候十五年总薪资也跟博士差不多
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务