antd⾃定义表单验证onBlur
<Form.Item label="邮箱" hasFeedback>
{getFieldDecorator('email', {
initialValue: ail,
validateFirst: true,
validateTrigger: 'onBlur',
rules: [
{
required: true,
whitespace: true,
message: '邮箱不能为空',
},
{
type: 'email',
message: '邮箱格式不合法!',
},
{
validator: this.validatorEmail,
},
],
})(<Input placeholder="请输⼊邮箱" />)}
<Form.Item label="邮箱" hasFeedback>
{getFieldDecorator('email', {
initialValue: ail,
validateFirst: true,
validate: [
{
trigger: 'onChange',
rules: [
{
required: true,
whitespace: true,
message: '邮箱不能为空',
},
{
input绑定onblur事件type: 'email',
message: '邮箱格式不合法!',
},
],
},
{
trigger: 'onBlur',
rules: [
{
validator: this.validatorEmail,
},
],
},
],
})(<Input placeholder="请输⼊邮箱" />)}
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论