Skip to content

Commit 5606017

Browse files
IvanwangcyIvan_雨
andauthored
fix(input-number): 在微信小程序中可以输入非数字或者不合法数字 #985 (#986)
Co-authored-by: Ivan_雨 <[email protected]>
1 parent 8629737 commit 5606017

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/components/input-number/index.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,15 @@ export default class AtInputNumber extends AtComponent<AtInputNumberProps> {
9797
errorValue: resultValue!
9898
})
9999
}
100+
if (resultValue && !Number(resultValue)) {
101+
resultValue = parseFloat(String(resultValue)) || min
102+
103+
this.handleError({
104+
type: 'OVER',
105+
errorValue: resultValue!
106+
})
107+
}
108+
100109
resultValue = parseValue(String(resultValue))
101110
return resultValue
102111
}

0 commit comments

Comments
 (0)