📜  材料 ui 文本字段错误 - 任何代码示例

📅  最后修改于: 2022-03-11 14:59:08.845000             🧑  作者: Mango

代码示例1
Using a react component state, one can store the TextField value and use that as an indicator for an error. Material-UI exposes the error and helperText props to display an error interactively.

Take a look at the following example:

 this.setState({ text: event.target.value })}
  error={text === ""}
  helperText={text === "" ? 'Empty field!' : ' '}
/>