antd validator ajax,antd的Form validator无效

伊光赫
2023-12-01

antd的Form validator无效,始终不能显示?代码如下。

usernameCheck=(rule,value,callback)=>{

if (value.length>6) {

callback('have value');

} else {

callback('have value less than 6');

}

}

render(){

const { getFieldDecorator } = this.props.form;

return (

footer={[

游客浏览

]}>

{getFieldDecorator('username', {

rules: [{

required: true, message: 'Please input your username!'

}, {

validator:this.usernameCheck,

}],

})

(} placeholder="Username" />

)}

...

}

 类似资料: