fix: set to null when password field is empty

This commit is contained in:
chenos 2021-01-07 12:48:51 +08:00
parent 285cf34c6a
commit 54fdb7ab46

View File

@ -13,11 +13,18 @@ export interface IPasswordProps extends PasswordProps {
export const Password = connect({ export const Password = connect({
getProps: mapStyledProps getProps: mapStyledProps
})(styled((props: IPasswordProps) => { })(styled((props: IPasswordProps) => {
const { value, className, checkStrength, ...others } = props const { value, className, checkStrength, onChange, ...others } = props
return ( return (
<span className={className}> <span className={className}>
<Input.Password {...others} value={value} /> <Input.Password
{...others}
value={value}
onChange={(e) => {
// 密码字段,如果没有设置不处理
onChange(e.target.value ? e : undefined);
}}
/>
{checkStrength && ( {checkStrength && (
<PasswordStrength value={String(value)}> <PasswordStrength value={String(value)}>
{score => { {score => {