答:可以通过对录入的字符串中的非法字符进行替换以实现录入非零开头的数字的目的。
setreading(e.target.value.replace(/[\D]*/g, '').replace(/^0/, ''));
测试:
- 1a3
- 13a
- 13e
- 013
希望结果是测试通过。
答:可以通过对录入的字符串中的非法字符进行替换以实现录入非零开头的数字的目的。
setreading(e.target.value.replace(/[\D]*/g, '').replace(/^0/, ''));
测试:
希望结果是测试通过。