Skip to content

Commit

Permalink
fix(taro-components): 修复 input type=number maxlength=-1 情况下,内容无法输入问题
Browse files Browse the repository at this point in the history
  • Loading branch information
beezen authored and ZakaryCode committed Sep 9, 2022
1 parent 03a4c10 commit b3a79ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/taro-components/src/components/input/input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class Input implements ComponentInterface {
const inputType = getTrueType(type, confirmType, password)
this.onInputExcuted = true
/* 修复 number 类型 maxlength 无效 */
if (inputType === 'number' && value && maxlength <= value.length) {
if (inputType === 'number' && value && maxlength > -1 && maxlength <= value.length) {
value = value.substring(0, maxlength)
e.target.value = value
}
Expand Down

0 comments on commit b3a79ac

Please sign in to comment.