正则表达式解决只能输入数字和小数点,最多只能输入4位小数的校验 /^[1-9]{1}\d{0,9}(\.\d{1,4})?$/ js获取文件的后缀名 const h = file.name.substring(file.name.lastIndexOf('.') + 1) 比如1.pdf得到pdf