[英]ant design form async-validator warning
I am using antd forms and rules and when im submiting a form i get warnings like:我正在使用 antd 表单和规则,当我提交表单时,我收到如下警告:
async-validator: ["Please enter username"].异步验证器:[“请输入用户名”]。
I tried { suppressWarning: true } but it didn't work, the warning is not the same text in the rule its the default template text我试过 { suppressWarning: true } 但它没有用,警告与规则中的文本不同,它是默认模板文本
antd: ^4.6.4蚂蚁:^4.6.4
<Form
{...layout}
name="basic"
initialValues={{
remember: true,
}}
onFinish={onFinish}
onFinishFailed={onFinishFailed}
>
<Form.Item
label="Username"
name="username"
rules={[
{
required: true,
message: 'Please input your username!',
},
]}
>
<Input />
</Form.Item>
<Form.Item
label="Password"
name="password"
rules={[
{
required: true,
message: 'Please input your password!',
},
]}
>
<Input.Password />
</Form.Item>
<Form.Item {...tailLayout} name="remember" valuePropName="checked">
<Checkbox>Remember me</Checkbox>
</Form.Item>
<Form.Item {...tailLayout}>
<Button type="primary" htmlType="submit">
Submit
</Button>
</Form.Item>
</Form>
As described on the async-validator page ( https://github.com/yiminghe/async-validator )如 async-validator 页面所述( https://github.com/yiminghe/async-validator )
At the entry point to your app you can do the following to disable the warning messages.在应用程序的入口点,您可以执行以下操作来禁用警告消息。
import Schema from 'async-validator';
Schema.warning = function(){};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.