Closed yunho1017 closed 4 months ago
⚡️ Deploying PR Preview...
感觉功能不是很有必要? 你有什么使用场景吗?给我几个看看
I think there are two scenarios for use.
Show guide text before Validation and show error message after Validation. e.g.
<ProFormText
label={"name"}
name={"name"}
help={({errors}) => errors.length ? errors[0] : "You can also input emojis and special character"}
rules={[Validations.required()]}
/>
Render custom error list e.g.
<ProFormText
label={"name"}
name={"name"}
help={({errors}) => <CustomErrorListField errors={errors}/>}
rules={[Validations.required()]}
/>
related: https://github.com/ant-design/ant-design/discussions/48001
Motivation
I want to use help props as guide message for the input. (always visible) so i use help props, I cant't see the validate error when after validation. i want to use help and validate together.
So I added a render type that passes errors to params.
As-is
code
before validate
after validate
After validation, help is displayed instead of the required error message.
To-be
code
before validate
after validate
After validation, I want to show an error message.
API
Basic Example