【发布时间】:2021-08-30 14:52:54
【问题描述】:
我有一个需要验证的 TextField:
minValue = 1
最大值 = 10
如果我使用 TextField 中的箭头,这些验证会起作用,但如果我直接在其中输入,我可以输入任何数字。我将如何修复/验证这个
<TextField
label="Selectati nota"
type="number"
id={subject._id}
value={subject.gradeData.grade}
onChange={(ev) => updateGrade(ev)}
disabled={loading}
size="small"
InputLabelProps={{style: {fontSize: 18, color:"#3F51B5"}}}
InputProps={{
style: {
fontSize:18, fontWeight:"bold"
},
inputProps: {
min: 1,
max: 10,
maxLength: 2,
// pattern: "^[1-9]d*$",
},
}}
style={{ width: 150, marginLeft: 10 }}
variant="filled"/>
【问题讨论】:
标签: javascript reactjs material-ui textfield