Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix maxLength for input of number type #6725

Merged
merged 1 commit into from May 20, 2020
Merged

Conversation

PPpro
Copy link
Contributor

@PPpro PPpro commented May 20, 2020

changeLog:

  • 修复 number 模式下,EditBox.maxLength 属性不生效的问题

@PPpro PPpro requested a review from holycanvas May 20, 2020
// input of number type doesn't support maxLength attribute
let maxLength = impl._delegate.maxLength;
if (maxLength >= 0) {
elem.value = elem.value.slice(0, maxLength);
Copy link
Contributor

@holycanvas holycanvas May 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果字符串比 maxLength 小,slice之后会变成什么?

Copy link
Contributor Author

@PPpro PPpro May 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不会有影响,取最大字符串长度

@PPpro PPpro merged commit ea1be12 into cocos:v2.4.0 May 20, 2020
1 check passed
@PPpro PPpro deleted the 240_editbox branch May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants