-
Notifications
You must be signed in to change notification settings - Fork 31
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: 修复 label 类型声明问题 #597
fix: 修复 label 类型声明问题 #597
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/growingio/gio-design/joodfgcr0 |
Codecov Report
@@ Coverage Diff @@
## master #597 +/- ##
==========================================
+ Coverage 83.10% 83.12% +0.01%
==========================================
Files 127 127
Lines 4221 4225 +4
Branches 1116 1118 +2
==========================================
+ Hits 3508 3512 +4
Misses 710 710
Partials 3 3
Continue to review full report at Codecov.
|
@@ -35,6 +37,7 @@ const ItemLabel: React.FC<Props> = (props: Props) => { | |||
const isOptional = !required && requiredMark === 'optional'; | |||
const innerMarker = isOptional ? '(选填)' : '*'; | |||
const mergedRequiredMarker = marker !== undefined ? marker : innerMarker; | |||
const mergedTitle = title ?? typeof label === 'string' ? (label as string) : '' |
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.
这里 label 如果我给了一个 ReactNode,不就变成空字符串了么?
能否考虑直接支持 ReactNode 类型的 label?因为有的时候会比较复杂
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.
title 只支持 string,label 支持 Reat.ReactNode
React.ReactNode
title: string
属性