为什么我的 Select 的 MenuProps 中的 PaperProps 中的样式不适用于 select
Why doesn't the style in my PaperProps within the MenuProps of my Select apply to the select
这个 select 中的白色填充不会消失,我觉得我已经尝试了 30 种变体和位置来使 css 停止显示。有什么建议吗?这是使用 MUI 5,我什至尝试将其基于 this 代码,我应用的样式在其中起作用,所以可能有什么问题?
用我的代码编写沙箱here
您似乎在尝试直接瞄准 MenuProps
时在基地使用带有 select
道具的 TextField
。 TextField API 没有 MenuProps
但它确实有 SelectProps
。尝试像这样将你的道具移动到那里(使用你的沙箱对我有用):
<StyledTextInput
select
defaultValue={"None"}
displayEmpty
SelectProps={{
MenuProps: {
PaperProps: {
sx: {
".MuiList-root": {
paddingTop: "0",
paddingBottom: "0"
}
}
}
}
}}
这个 select 中的白色填充不会消失,我觉得我已经尝试了 30 种变体和位置来使 css 停止显示。有什么建议吗?这是使用 MUI 5,我什至尝试将其基于 this 代码,我应用的样式在其中起作用,所以可能有什么问题?
用我的代码编写沙箱here
您似乎在尝试直接瞄准 MenuProps
时在基地使用带有 select
道具的 TextField
。 TextField API 没有 MenuProps
但它确实有 SelectProps
。尝试像这样将你的道具移动到那里(使用你的沙箱对我有用):
<StyledTextInput
select
defaultValue={"None"}
displayEmpty
SelectProps={{
MenuProps: {
PaperProps: {
sx: {
".MuiList-root": {
paddingTop: "0",
paddingBottom: "0"
}
}
}
}
}}