mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 04:05:53 +08:00
fix: input not set min or max null value blur would set null (#2361)
This commit is contained in:
parent
5a004ae429
commit
f95839c785
@ -26,12 +26,14 @@ const Input: FC<InputProps> = ({
|
||||
max,
|
||||
}) => {
|
||||
const toLimit = (v: string) => {
|
||||
if (min !== undefined && parseFloat(v) < min) {
|
||||
const minNum = parseFloat(`${min}`)
|
||||
const maxNum = parseFloat(`${max}`)
|
||||
if (!isNaN(minNum) && parseFloat(v) < minNum) {
|
||||
onChange(`${min}`)
|
||||
return
|
||||
}
|
||||
|
||||
if (max !== undefined && parseFloat(v) > max)
|
||||
if (!isNaN(maxNum) && parseFloat(v) > maxNum)
|
||||
onChange(`${max}`)
|
||||
}
|
||||
return (
|
||||
|
Loading…
x
Reference in New Issue
Block a user