我如何在 不 使用以下代码的 情况下 隐藏/删除TextField组件中的下划线:
const theme = createMuiTheme({ overrides: { MuiInput: { underline: { '&:hover:not($disabled):before': { backgroundColor: 'rgba(0, 188, 212, 0.7)', }, }, }, }, });
我想用道具,并根据文档:https : //material- ui.com/api/input/
我应该能够更改下划线道具,但是它不起作用。
这是您的操作方式:
<TextField id="name" label="Name" value={this.state.name} margin="normal" InputProps={{disableUnderline: true}} />
我怎么知道的?
您已链接到Input文档,该文档确实具有disableUnderline支持。
Input
disableUnderline
但是,您正在使用TextField组件:
TextField
重要的是要了解,文本字段是以下组件之上的简单抽象: 表格控件 输入标签 输入项 FormHelperText
重要的是要了解,文本字段是以下组件之上的简单抽象:
如果您查看以下可用道具的清单TextField:
InputProps-对象-应用于Input元素的属性。