antd - Checkbox多选(Tab) 类型样式

Tab多选样式
在这里插入图片描述
解决方式
在这里插入图片描述

<Form.Item name="detectionIds" label="XXXX" rules={[{ required: true, message: '请选择XXXX' }]}>
  <Checkbox.Group onChange={(ids) => categoryChange(ids)} className={styles.specimenCheckbox}>
   {(detectionData || []).map((item: any, index: number) => {
     if (index === 0) item.isGray = true;
     return (
       <Checkbox
         key={item.id}
         value={item.id}
         className={item.isChoose ? styles.checkboxItemStatus : styles.checkboxItem}
         style={{ border: item.isChoose ? '1px solid #1890ff' : '' }}
       >
         <span className={styles.checkboxItemHr} />
         <div style={{ color: item.isChoose ? '#1890ff' : item?.isGray ? '#CCC' : '' }}>{item.detection.name}</div>
       </Checkbox>
   )})}
   </Checkbox.Group>
</Form.Item>

Less

.specimenCheckbox {
  :global {
    .ant-checkbox {
      display: none;
    }
    .ant-checkbox-wrapper + .ant-checkbox-wrapper {
      margin-left: 0;
      border-left: none !important;
    }
    .ant-checkbox-wrapper:first-child {
      border-radius: 2px 0 0 2px;
    }
    .ant-checkbox-wrapper:last-child {
      border-radius: 0 2px 2px 0;
    }
  }
}
.checkboxItem:not(:first-child) {
  .checkboxItemHr {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    box-sizing: content-box;
    width: 1px;
    height: 100%;
    padding: 0;
    border-left: 1px solid #d9d9d9;
  }
}
.checkboxItemStatus {
  border-left: none !important;
}
.checkboxItemStatus {
  position: relative;
  .checkboxItemHr {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    box-sizing: content-box;
    width: 1px;
    height: 100%;
    padding: 0;
    z-index: 1;
    border-left: 1px solid #1890ff;
  }
}
.checkboxItem, .checkboxItemStatus {
  border: 1px solid #d9d9d9;
  padding: 0 15px;
  height: 32px;
  line-height: 32px;
}
.checkboxItem:hover {
  color: #1890ff;
}
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值