Skip to content

feat: improved event response for input elements #629

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

Closed

Conversation

Wxh16144
Copy link
Contributor

@Wxh16144 Wxh16144 commented Nov 8, 2023

背景

在 antd 的 fromItem 中使用 Switch or Radio 都需要手动修改 valuePropName 比较繁琐。

解决方案

改 PR 并不是为了解决 antd 侧的问题,而是进一步优化了 imput change 事件。

BREAKING CHANGE:

原来 type=“number" 得到的值从 string 类型变成 number 类型。
原来 type="files" 得到的值从 value 变成 FileList 对象

BREAKING CHANGE:

<input type="number" /> puts back the value from `string` to `number`, but the value remains unchanged!!!
Copy link

vercel bot commented Nov 8, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
field-form ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 8, 2023 10:23am

Copy link

codecov bot commented Nov 8, 2023

Codecov Report

Merging #629 (8fd1625) into master (164c2e9) will decrease coverage by 0.08%.
The diff coverage is 90.90%.

❗ Current head 8fd1625 differs from pull request most recent head ad91671. Consider uploading reports for the commit ad91671 to get more accurate results

@@            Coverage Diff             @@
##           master     #629      +/-   ##
==========================================
- Coverage   99.43%   99.35%   -0.08%     
==========================================
  Files          18       18              
  Lines        1236     1245       +9     
  Branches      283      290       +7     
==========================================
+ Hits         1229     1237       +8     
- Misses          7        8       +1     
Files Coverage Δ
src/utils/valueUtil.ts 96.61% <90.90%> (-1.39%) ⬇️

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

@afc163
Copy link
Member

afc163 commented Nov 8, 2023

让 Switch 直接支持 value 就行了。

@Wxh16144
Copy link
Contributor Author

Wxh16144 commented Nov 8, 2023

让 Switch 直接支持 value 就行了。

这个逻辑应该是在 antd 侧实现,当前 PR 想做的是改进这个 event target 逻辑

@Wxh16144
Copy link
Contributor Author

Wxh16144 commented Nov 8, 2023

先 close 了,确实不太合适(毕竟还存在 BreakChange,

不过借机会学习了 input 标签的几个 type,把当前 PR 的 demo pick 出来重新开一个 PR~

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.

2 participants