fix(uniapp): preserve empty string values in Radio and Checkbox - #4607
Open
luppyw wants to merge 1 commit into
Open
fix(uniapp): preserve empty string values in Radio and Checkbox#4607luppyw wants to merge 1 commit into
luppyw wants to merge 1 commit into
Conversation
luppyw
requested review from
anlyyao,
betavs,
jarmywang,
jin0209,
novlan1 and
zydemail
as code owners
August 14, 2026 10:24
Author
|
@PengYYYYY 方便时能否帮忙审核一下这个 PR?如果实现思路和修改没有问题,并且必要检查通过,辛苦帮忙合并一下;如有任何建议,我会及时跟进调整。感谢! English versionCould you please review this PR when you have time? If the implementation and changes look correct and the required checks pass, would you be willing to merge it? I will address any feedback promptly. Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤔 这个 PR 的性质是?
🔗 相关 Issue
Closes #4604
💡 需求背景和解决方案
UniApp 公共 props 处理器会将联合类型中的
Boolean移到首位,使 Radio 和 Checkbox 声明的[String, Number, Boolean]变成[Boolean, String, Number]。Vue 因此会将value=""按布尔属性转换为true。本 PR 保留 props 声明中的原始类型顺序,使空字符串继续作为字符串传递,同时避免公共处理器原地修改类型数组。新增 Radio 和 Checkbox 回归测试,并将 UniApp 测试目录纳入现有 Jest 配置。
验证结果:
pnpm build:uniapp构建通过English version
The shared UniApp props normalizer moved
Booleanto the front of union types. This changed the Radio and Checkboxvaluedeclaration from[String, Number, Boolean]to[Boolean, String, Number], causing Vue to castvalue=""totrue.This PR preserves the declared prop type order so empty strings remain strings and the original type arrays are not mutated. It also adds regression coverage for Radio and Checkbox and includes UniApp tests in the existing Jest configuration.
Verification:
pnpm build:uniapppassed📝 更新日志
tdesign-miniprogram
无
@tdesign/uniapp
value为空字符串时被转换为true的问题@tdesign/uniapp-chat
无
☑️ 请求合并前的自查清单