-
Notifications
You must be signed in to change notification settings - Fork 143
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
feat: button #730
feat: button #730
Conversation
jc9702507
commented
May 18, 2023
•
edited
Loading
edited
- button 可使用formType
🎊 PR Preview d97629f has been successfully built and deployed to https://ant-design-ant-design-mini-preview-pr-730.surge.sh 🕐 Build time: 226.883s 🤖 By surge-preview |
@@ -2,7 +2,7 @@ | |||
|
|||
|
|||
<button | |||
form-type="{{htmlType}}" | |||
form-type="{{formType}}" | |||
hover-class="{{utils.getHoverClass(loading, type, activeClassName)}}" | |||
scope="{{scope}}" | |||
onTap="{{onTap ? 'onTap' : ''}}" |
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.
代码修补补丁如下,请允许我做一个简要的代码评审。
修补前后文件只有一行不同,在第二行代码中将 form-type="{{htmlType}}"
改为了 form-type="{{formType}}"
。这个修补对于代码的功能没有影响,只是改变了 HTML 属性的名称。
在此代码段中,没有安全隐患或性能问题,并且对于功能实现来说也无需进行进一步的优化。如果只有这一行代码的更改且符合编码规范,那么这个代码提交应该是可以接受的。
@@ -82,6 +82,6 @@ export interface IButtonProps extends IBaseProps { | |||
|
|||
export const ButtonDefaultProps: Partial<IButtonProps> = { | |||
type: 'default', | |||
htmlType: 'button', | |||
formType: 'button', | |||
size: 'medium', | |||
}; |
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.
这个代码补丁对 interface IButtonProps
进行了修改,将 htmlType
字段更名为 formType
。同时,在默认属性中,也将 htmlType
改为 formType
。
看起来这些代码变更的类型检查应该不会引入风险。可以尝试在现有业务场景中进行测试以确保没有破坏原有逻辑。
关于代码改进,建议增加注释以提高代码可读性和可维护性。另外,如果相关规范存在,可以遵守其命名约定。例如,可以使用全称 formButtonType
来表示 formType
。
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## master #730 +/- ##
=======================================
Coverage 24.01% 24.01%
=======================================
Files 158 158
Lines 3339 3339
Branches 875 875
=======================================
Hits 802 802
Misses 2206 2206
Partials 331 331
☔ View full report in Codecov by Sentry. |