javascript - 仅允许在材质 ui 中达到一定长度的数字
问题描述
我们需要用户只输入数字,它的最大长度应该是 3。我们如何在材料 ui 中完成这个?
<TextField
id="score"
label="score"
className={classes.textField}
name="totalScore"
margin="normal"
defaultValue={score}
/>
我们这里只需要数值
解决方案
尝试这个...
<TextField
id="score"
label="score"
name="totalScore"
style={style.filedStyle}
inputProps={{ min: 3, max: 3}}
/>
推荐阅读
- spring - 403 请求中没有包含有效的面包屑
- java - 两个变量相同,甚至应该不同的原因是什么?
- json - 使用 bashscript 从 API 保存 JSON
- javascript - 单击按钮滚动到元素
- python - 如何在数组中更改数组
- javascript - 如何在 docker-compose 中将 Nuxt 应用程序链接到 API 服务器
- c# - 为什么 MessageBox.Show 在该代码中不起作用?
- diff - 在快照和数据库之间生成变更日志
- php - 获取分页 Laravel 的总页数并写入文件页码
- mysql - 列出因其物种专业知识而获得最高薪水的任何员工的员工详细信息