-
Notifications
You must be signed in to change notification settings - Fork 379
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: 给numberInput组件增加dynamicDecimal属性,支持用户保留完整的小数位数 #1945
base: master
Are you sure you want to change the base?
feat: 给numberInput组件增加dynamicDecimal属性,支持用户保留完整的小数位数 #1945
Conversation
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.
搜一下用到 decimal
这个 props 的地方,我感觉有遗漏的地方,没这么简单。
decimalPlaces === DYNAMIC_DECIMAL_SIGN | ||
? getDecimalsLength(decimal) | ||
: decimalPlaces |
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.
逻辑收到 getDecimalsLength
里面去
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.
- 如果觉得有遗漏的地方,需要提出具体哪里遗漏
getDecimalsLength
这个方法,如果只有这个地方用到,我是建议保持现状,职责单一
@@ -12,6 +12,9 @@ export function isDecimal(value: string): boolean { | |||
return /^[-+]?\d*\.?\d*$/.test(value); | |||
} | |||
|
|||
// 表示小数点位数取用户实际输入的小数点位数 | |||
const DYNAMIC_DECIMAL_SIGN = -1; |
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.
我觉得 Infinity
更合适
Changes you made in this pull request: