redux表单如何显示异步验证成功



我有一个带有redux-form和异步验证功能的更改密码表单。

如何判断异步验证何时成功完成?

我试图从道具中获取字段数据,但我得到了undefined

如何做到这一点?

function ChangePassword(props) {
console.log(props);
return (
<div className="general-information-container ">
<form className="relative general-information-form change-password-container">
<div className="field-header">Genreal information</div>
<Field
name="currentPassword"
component={renderField}
type="password"
placeholder="Enter you current password"
label="Current Password"
/>
<Field
name="newPassword"
component={renderField}
type="password"
label="New Password"
placeholder="Enter New Password"
/>
<Field
name="confirmNewPassword"
component={renderField}
type="password"
label="Confirm Password"
placeholder="Confirm Password"
/>
<button type="submit" className="edit-values">
Change Password
</button>
</form>
</div>
);
}
export default reduxForm({
form: "changePassword",
asyncValidate: passwordAsyncValidate,
asyncBlurFields: ["currentPassword"],
})(ChangePassword); 

感谢

这是redux表单文档中的一个很好的例子。

https://codesandbox.io/s/nKlYo387

希望这能有所帮助。

最新更新