-
-
Notifications
You must be signed in to change notification settings - Fork 175
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
Feature/新增非法输入警告 #409
base: master
Are you sure you want to change the base?
The head ref may contain hidden characters: "feature/\u65B0\u589E\u975E\u6CD5\u8F93\u5165\u8B66\u544A"
Feature/新增非法输入警告 #409
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/react-component/input-number/FPrAgAiS3nyMyxvgJA3fUxbxYqyf |
Codecov Report
@@ Coverage Diff @@
## master #409 +/- ##
==========================================
+ Coverage 97.76% 97.79% +0.02%
==========================================
Files 9 9
Lines 448 453 +5
Branches 116 117 +1
==========================================
+ Hits 438 443 +5
Misses 10 10
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
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.
输入负值的过程一般会先输入'-',最好做下兼容
@@ -399,8 +401,17 @@ const InputNumber = React.forwardRef( | |||
collectInputValue(inputRef.current.value); | |||
}; | |||
|
|||
const judgeData = (inputNumberValue: 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.
感觉这个方法跟 isInvalidate isInRange 是重复的
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.
👌,我下午再更改一下提上来。
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.
isInvalidate的作用是判断是否为空或者判断该值是否是一个数字,isInRange的作用是判断输入值是否在区间范围内,貌似可以用这两个方法结合起来去取代judgeData;
但这两个方法是decimalValue的静态方法,在用户输入的时候,decimalValue拿不到最新的值,比如原本输入框是5,我再输入一个5,在input的onChange事件中,decimalValue的拿到的值是5而不是55,这一点你觉得有什么比较好的解决方法吗?
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.
可以用 inputValue,那个是实时的。
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -531,7 +540,7 @@ const InputNumber = React.forwardRef( | |||
[`${prefixCls}-disabled`]: disabled, | |||
[`${prefixCls}-readonly`]: readOnly, | |||
[`${prefixCls}-not-a-number`]: decimalValue.isNaN(), |
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.
非数字其实应该在此处判断,更符合语义,不过这个 css 类名没写样式。需要在 assets\index.less
L19 加上 &-not-a-number
写了个用 inputValue 的版本 |
@zombieJ 来 CR 一下? |
[English Template / 英文模板]
🤔 这个变动的性质是?
🔗 相关 Issue
#34987
💡 需求背景和解决方案
📝 更新日志
☑️ 请求合并前的自查清单