mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 05:16:00 +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,
|
max,
|
||||||
}) => {
|
}) => {
|
||||||
const toLimit = (v: string) => {
|
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}`)
|
onChange(`${min}`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max !== undefined && parseFloat(v) > max)
|
if (!isNaN(maxNum) && parseFloat(v) > maxNum)
|
||||||
onChange(`${max}`)
|
onChange(`${max}`)
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user