产品说,需要把Switch
组件选中时是“红色”背景,不选中时是“蓝色”背景。效果如下:
1.创建一个less
文件
@import '~antd/es/style/variable.less';
.box{
.ant-table-cell:nth-child(8){
.ant-switch-checked:nth-child(1) {
background-color: #1677FF;
background-color: red;
}
.ant-switch{
background-color: #1677FF;
}
}
}
2.在文件中引入less
样式文件
import './UserList.less'
<div className='box'>
<Table
loading={loading}
rowKey={(record) => `${record.platformId}-${record.userId}`}
columns={columns}
dataSource={userList}
bordered
pagination={pagination}
onChange={handleTableChange}
/>
</div>
标签:less,color,ant,Switch,background,组件,antd
From: https://www.cnblogs.com/zhengyeye/p/16847936.html