-
-
Notifications
You must be signed in to change notification settings - Fork 50.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(FormItem): add name as default variables.label value #30179
Conversation
Codecov Report
@@ Coverage Diff @@
## master #30179 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 397 397
Lines 7519 7563 +44
Branches 2105 2128 +23
=========================================
+ Hits 7519 7563 +44
Continue to review full report at Codecov.
|
@@ -265,6 +265,8 @@ function FormItem<Values = any>(props: FormItemProps<Values>): React.ReactElemen | |||
let variables: Record<string, string> = {}; | |||
if (typeof label === 'string') { | |||
variables.label = label; | |||
} else if (name) { | |||
variables.label = String(name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you help to add a test case about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will add the test case as soon as possible ~
…30179) * fix(FormItem): add name as default variables.label value * test(Form.Item): add name as default test
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
Fix #30146. When
label
is not given,${label}
will be replaced byundefined
. I think we could addname
as a defaultvariables.label
value.💡 Background and solution
📝 Changelog
name
as a default label value invalidationMessages
.name
作为验证消息label
的默认值☑️ Self Check before Merge