antd + react自定义校验
<Form.Item label="文章标题" name="articaltest" rules={[{ validator: (rule, value) => { console.log({rule, value}) } }]} validateStatus={this.state.myvalidateStatus} hasFeedback help={this.state.myhelp} rules={[{ validator: async (rule, value) => { console.log({rule, value}); if (value.length > 5) { throw new Error('超出最大长度'); this.setState({ myvalidateStatus: 'error', myhelp: '超出最大长度' }) } else{ this.setState({ myvalidateStatus: undefined, myhelp: undefined }) } } }]} > <Input placeholder='请输入文章标题' /> </Form.Item>