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

feat: inputnumber add currency support #2742

Open
wants to merge 1 commit into
base: release
Choose a base branch
from
Open

Conversation

YannLynn
Copy link
Collaborator

@YannLynn YannLynn commented Mar 3, 2025

中文模板 / Chinese Template

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Test Case
  • TypeScript definition update
  • Document improve
  • CI/CD improve
  • Branch sync
  • Other, please describe:

PR description

Feat #
主要思路是利用 Intl.NumberFormat 进行数字到货币字符的转换,搭配上对应的内置 formatter & parser。
在 handleInputKeyDown 函数中对一些特殊 case 做了处理

  1. 非结尾小数点符号,不允许删除
  2. 当前位置为小数字符时,删除该位等于置零该位
  3. 当前位置为小数字符时,输入数字字符等于直接替换当前位置

🚧

  • 补充测试用例
  • 说明文档更新(inputnumber + locale)

Changelog

🇨🇳 Chinese

  • Feat: InputNumber 支持货币模式

🇺🇸 English

  • Feat: InputNumber supports currency mode

Checklist

  • Test or no need
  • Document or no need
  • Changelog or no need

Other

  • Skip Changelog

Additional information

@YannLynn YannLynn requested a review from shijiatongxue March 3, 2025 13:06
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.

1 participant