Skip to content

Commit

Permalink
fix: maxlength属性传入-1时应不限制长度,传入非法值时应为默认限制
Browse files Browse the repository at this point in the history
  • Loading branch information
Wangyaqi committed Mar 7, 2024
1 parent c71647a commit 887aad7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/uni-components/src/helpers/useField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,11 @@ function useBase(
})
const maxlength = computed(() => {
var maxlength = Number(props.maxlength)
return isNaN(maxlength) ? 140 : maxlength
return maxlength === -1
? Infinity
: isNaN(maxlength) || maxlength <= 0
? 140
: maxlength
})
const value =
getValueString(props.modelValue, props.type) ||
Expand Down

0 comments on commit 887aad7

Please sign in to comment.