Javascript 反应:更改树选择(antD组件)的背景色
我正在尝试更改的TreeSelect组件的背景色 尝试了以下方法:Javascript 反应:更改树选择(antD组件)的背景色,javascript,css,reactjs,antd,Javascript,Css,Reactjs,Antd,我正在尝试更改的TreeSelect组件的背景色 尝试了以下方法: // const bgColor = element.Style !== undefined && element.Style === Constants.StyleModes.MAJOR ? // "#CFECF5" : "white" //TODO - didn't override the ant-select-selector
// const bgColor = element.Style !== undefined && element.Style === Constants.StyleModes.MAJOR ?
// "#CFECF5" : "white" //TODO - didn't override the ant-select-selector
// const listStyle = element.Style !== undefined && element.Style === Constants.StyleModes.MAJOR ?
// "small-font styled-element" : "small-font"
elements.push(
<td className="view-cell" align="left">
{element.Name}
<br/>
<TreeSelect
className="small-font"
style={{ width: '100%', fontSize: 'small' /*, backgroundColor: bgColor*/}}
尝试以下操作(您可以在DevTools中看到正确的选择器):
.treeSelect.ant选择单个:非(.ant选择自定义输入)
.ant选择选择器{
背景色:aliceblue;
}
谢谢你,丹尼斯。它影响了所有列表的样式,而不是我感兴趣的唯一列表!我不确定你的意思,这是根据你的图像得出的值。我的意思是,我的表格中有多个列表,我不想影响所有列表。。。只有一些。你给的风格影响了他们为什么要这样?它只影响那些带有
className=“treeSelect”
的,请参阅更新的沙盒,显示没有这种效果。忽略它,我的坏(忘记删除旧样式)。工作得很好,非常感谢
.ant-select-selector {
background-color: #CFECF5 !important;
}
.treeSelect.ant-select-single:not(.ant-select-customize-input)
.ant-select-selector {
background-color: aliceblue;
}
<TreeSelect className="treeSelect"/>