我有一个表单,其中包含一个antD Select组件.
<Select
name="SeasonId"
onChange={onSeasonChange}
placeholder="Choose Season"
>
// Select Options
</Select>
我希望能够改变 colored颜色 的边界(和框阴影)根据条件.我可以通过在单独的css文件中添加以下内容来更改/覆盖所需的css:
.ant-select-selector:hover {
border-color: #1f9643e5 !important;
}
.ant-select-focused .ant-select-selector,
.ant-select-selector:focus,
.ant-select-selector:active,
.ant-select-open .ant-select-selector {
border-color: #1f9643e5 !important;
outline: 0 !important;
-webkit-box-shadow: 0 0 0 2px rgba(49, 139, 54, 0.342) !important;
box-shadow: 0 0 0 2px rgba(49, 139, 54, 0.342) !important;
}
这将改变我追求的风格:#
但是,我只想在代码中满足特定条件(即我有一个isEditMode状态bool)的情况下,将此样式覆盖应用于Select.我可能错过了一些明显的东西,但我对听到任何建议都感兴趣.