element-ui react Form 组件校验规则required=true失败

出现的错误

required = true时,即使表单输入框有值,也会报错

问题原因

element-ui form校验通过async-validate实现,async-validate默认检验内容type=string,而此时我们输入框值为后台返回的Int (js里是 number)

解决方法

每个规则项加入 type  类型

猜你喜欢

转载自blog.csdn.net/weixin_42052388/article/details/80211080