我尝试在字段上使用onInvalid来验证表单以更改消息。除了写给我[对象:对象]
<CustomInputValidation
labelText={<FormattedMessage id="LoginTemplate.email" defaultMessage="Email"/>}
id="email"
formControlProps={{
fullWidth: true,
error:errors.email === true ? true : false, required: true,
onInvalid: (e) => e.target.setCustomValidity(<FormattedMessage id="LoginTemplate.email" defaultMessage="Email"/>),
onInput: (e) => e.target.setCustomValidity('')
}}
inputProps={{
onChange:this.handleChange,
type: "email",
name:"email",
value:authentification.email,
endAdornment: (
<InputAdornment position="end">
<Email className={classes.inputIconsColor}/>
</InputAdornment>
)
}}
boolError={errors.email === true ? true : false}
labelError={<FormattedMessage id="LoginTemplate.email.error" defaultMessage="The email is required"/>}
/>