Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

davedavehong
Copy link

Changes you made in this pull request:

  • numberInput组件增加dynamicDecimal属性,支持用户保留完整的小数位数
  • dynamicDecimal优先级高于固定位数的dynamicDecimal属性

Copy link
Contributor

@cpylua cpylua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

搜一下用到 decimal 这个 props 的地方,我感觉有遗漏的地方,没这么简单。

Comment on lines 112 to 114
decimalPlaces === DYNAMIC_DECIMAL_SIGN
? getDecimalsLength(decimal)
: decimalPlaces
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

逻辑收到 getDecimalsLength 里面去

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 如果觉得有遗漏的地方,需要提出具体哪里遗漏
  2. getDecimalsLength 这个方法,如果只有这个地方用到,我是建议保持现状,职责单一

@@ -12,6 +12,9 @@ export function isDecimal(value: string): boolean {
return /^[-+]?\d*\.?\d*$/.test(value);
}

// 表示小数点位数取用户实际输入的小数点位数
const DYNAMIC_DECIMAL_SIGN = -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得 Infinity 更合适

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants